返回列表 上一主題 發帖

[發問] Error 'Object variable or With block variable not set'

回復 1# zxcxz
可改成這樣,因為c為nothing時無法再判斷c.address
  1. With Worksheets(1).Range("a1:a500")
  2.     Set c = .Find(2, LookIn:=xlValues)
  3.     If Not c Is Nothing Then
  4.         firstAddress = c.Address
  5.         Do
  6.             c.Value = 5
  7.             Set c = .FindNext(c)
  8.             If c Is Nothing Then Exit Do
  9.         Loop While c.Address <> firstAddress
  10.     End If
  11. End With
複製代碼

TOP

        靜思自在 : 話多不如話少,話少不如話好。
返回列表 上一主題