按照微信平台教程调试findnext函数,Loop While Not c Is Nothing And c.Address <> firstAddress报错"对象变量或With块变量未设置",该如何解决?谢谢
本示例在单元格区域 A1:A500 中查找值为 2 的单元格,并将这些单元格的值变为 5。
With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With