0
我是新來編寫VBA代碼,並且在線下面遇到了這個代碼,這與我正在嘗試做的非常相似。但是,當我嘗試運行它時,它會突出顯示Loop While Not c Is Nothing And c.Address <> firstAddress
行,並彈出一條消息,提示「對象變量或塊變量未設置」。Excel VBA代碼
有誰知道如何解決這個問題?任何幫助深表感謝!
Sub Commodity()
'
' Commodity Macro
' Commodity
'
'
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
End Sub
太棒了!感謝您的快速,有益的迴應:) –