我在VBA很新,所以我敢肯定,我想的東西容易...我得到一個編譯錯誤「循環離不開」做環路誤差在VBA代碼
被調用函數GrabDataFromMinutes我已經自行測試成功了。任何幫助表示讚賞,謝謝!
Public Sub CopyAllData()
Dim Location As String
Location = ActiveCell.Address
Dim CellValue As String
CellValue = ActiveCell.Value
Do
If IsEmpty(CellValue) = True Then 'If cell is empty skip row'
ActiveCell.Offset(rowOffset:=1, ColumnOffset:=-1).Activate
Loop
If Location <> "C350" Then 'run the command unless EOF'
Application.Run ("GrabDataFromMinutes")
MsgBox "I got here"
Location = ActiveCell.Address
Loop
End If
Exit Do
End Sub
您需要切換結束if和loop。如果在循環內啓動,則不能在循環外部結束循環。也刪除退出做。 –
你只想去一排嗎?現在你的代碼會向下一行,一列過來 – Davesexcel