我在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