返回列表 上一主題 發帖

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

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

以下程序執行到紅色部份就出現error 'Object variable or With block variable not set',原因是什麼?

來至微軟官方網:http://msdn.microsoft.com/en-us/library/office/aa195732%28v=office.11%29.aspx
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

謝謝版主及stillfish00講解

TOP

        靜思自在 : 世上有兩件事不能等:一、孝順 二、行善。
返回列表 上一主題