我正在尝试删除E列中包含0的所有行。它被格式化为Currency并且给了我一些问题。
以下是我目前正在使用的代码,但它无效:
' Delete Anything in Column E with a hyphen
Dim e As Range
Dim rngToDelete2 As Range
With Worksheets(5).Range("E1:E2000")
Set e = .Find("0", LookIn:=xlValues)
If Not e Is Nothing Then
firstAddress = e.Address
Do
If rngToDelete2 Is Nothing Then
Set rngToDelete2 = e
Else
Set rngToDelete2 = Union(rngToDelete2, e)
End If
Set e = .FindNext(e)
If e Is Nothing Then Exit Do
Loop While e.Address <> firstAddress
End If
End With
If Not rngToDelete2 Is Nothing Then rngToDelete2.EntireRow.Delete
不确定原因,这适用于包含连字符或0的其他列。感谢任何帮助。
答案 0 :(得分:0)
不理想,但我最终将列重新格式化为0.000而不是货币。这解决了所有问题。
感谢您的帮助。