我想搜索特定表格中的范围A1-A99(wsCaseinfo)中的单词Overview.我在'with'行上收到1004错误.
该代码是使用2个不同文件中的3个不同表格的较大代码的一部分.代码循环通过100个文件,因此有效的东西将被赞赏.非常感谢您的帮助.
With wsCaseinfo.Range(Cells(1, 1), Cells(99, 1))
Set cellx = .Find(what:="Overview", LookAt:=xlPart)
End With
Run Code Online (Sandbox Code Playgroud)
您需要附加Cells()
父表单:
With wsCaseinfo.Range(wsCaseinfo.Cells(1, 1), wsCaseinfo.Cells(99, 1))
Run Code Online (Sandbox Code Playgroud)
其他方面,Cells()
将指的是活动表,而不是相同的表Range()
.
您也可以With
在第一个中嵌套With
With wsCaseinfo
With .Range(.Cells(1, 1), .Cells(99, 1))
Set cellx = .Find(what:="Overview", LookAt:=xlPart)
End With
End With
Run Code Online (Sandbox Code Playgroud)