嘿伙计们,我正在尝试编写一个代码来删除具有使用公式找到的值的行。问题是每隔一行都是 a #VALUE!
,由于报告的设置,我无法更改。最后,我想删除所有具有的#VALUE!
行以及具有小于 .75 in 的值的任何行Column H
。
我尝试的代码如下所示:
Private Sub CommandButton1_Click()
Dim rng As Range, cell As Range, del As Range
Set rng = Intersect(Range("H1:H2000"), ActiveSheet.UsedRange)
For Each cell In rng
If (cell.Value) < .75 Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next cell
On Error Resume Next
del.EntireRow.Delete
End Sub
任何帮助或提示将不胜感激。