我想删除A列中包含#REF
的每一行。
我的代码仅适用于value
,不适用于#REF
。
Dim varFindThis As Variant
Dim rngLookIn As Range
Dim f As String
varFindThis = Worksheets("Suivi2").Range("B1")
Set rngLookIn = Worksheets("Suivi2").Range("A:A")
If Not rngLookIn.Find(varFindThis, LookIn:=xlValues) Is Nothing Then
f = Worksheets("Suivi2").Range("B1").Value
'Since i didn't got that clear, here above you must create a code to declare "f" as whatever you want
Set c = Worksheets("Suivi2").Range("A:A").Find(f)
Worksheets("Suivi2").Range(c.Address).EntireRow.Delete
End If
答案 0 :(得分:0)
您可以使用Range.SpecialCells method快速找到Worksheet.UsedRange property中的所有错误。
on error resume next
with Worksheets("Suivi2").Columns(1)
if not .specialcells(xlCellTypeFormulas, xlErrors) is nothing then _
.specialcells(xlCellTypeFormulas, xlErrors).EntireRow.Delete
end with
on error goto 0