- 帖子
- 1018
- 主題
- 15
- 精華
- 0
- 積分
- 1058
- 點名
- 0
- 作業系統
- win7 32bit
- 軟體版本
- Office 2016 64-bit
- 閱讀權限
- 50
- 性別
- 男
- 來自
- 桃園
- 註冊時間
- 2012-5-9
- 最後登錄
- 2022-9-28
|
回復 5# esperanto
應該是你在別的程式,在找到c後不會改掉c的值,所以loop中不會有c為nothing(找不到下一個)的問題。
而VBA說明範例- 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
複製代碼 說明範例有c.value = 5 ,2都改為5後就找不到2了
而你的例子,有Range(Worksheets("Scheduling").Cells(c.Row, 1), Worksheets("Scheduling").Cells(c.Row + 1, 9)).ClearContents
會把你找的machine清掉,所以FindNext最後會傳回Nothing |
|