Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用VBA删除带有REF的每一行_Vba_Excel - Fatal编程技术网

使用VBA删除带有REF的每一行

使用VBA删除带有REF的每一行,vba,excel,Vba,Excel,我想删除A列中包含REF的每一行 我的代码只适用于value,而不适用于REF 可以使用快速查找中的所有错误 工作表上还有其他潜在的错误吗?我只是还有一个问题,当没有带错误的单元时,就是给我写一个VBA错误单元找不到。如何避免这种情况?您可以指定,如果遇到错误,进程只需恢复处理即可。见我的编辑上面。 Dim varFindThis As Variant Dim rngLookIn As Range Dim f As String varFindThis = Worksheets("Suivi2

我想删除A列中包含REF的每一行

我的代码只适用于value,而不适用于REF

可以使用快速查找中的所有错误


工作表上还有其他潜在的错误吗?我只是还有一个问题,当没有带错误的单元时,就是给我写一个VBA错误单元找不到。如何避免这种情况?您可以指定,如果遇到错误,进程只需恢复处理即可。见我的编辑上面。
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
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