2
我想删除列E中包含0的所有行。它被格式化为货币,并给我一些问题。删除行包含0格式化为货币
这是我目前使用的代码,但它不工作:
' 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。任何帮助表示赞赏等栏目。
上面的代码适用于我。你见过[这](http://stackoverflow.com/questions/20077945/delete-cells-in-an-excel-column-when-rows-0)如果你没有大行,那么你也可以使用自动过滤器如该帖子中的@brettdj所示。 –
如果它仍然不起作用,那么我想看看你的工作簿。这可以确保解决问题的速度更快。如果你愿意,然后在www.wikisend.com等网站上传它,然后在这里分享链接:) –
很快就会完成。不知道为什么,但它留下了一些行。这真的很奇怪。 – SASUSMC