I'm getting a "object variable or with block variable not set" error message when running the following code. It is in Access and refers to an Excel spreadsheet. What is wrong with the code?
wsTest.Range("A11").Activate
Do Until IsEmpty(ActiveCell)
intX = intX + wsTest.Cells(ActiveCell.Row, "L") 'error occurs on this line
intY = intY + wsTest.Cells(ActiveCell.Row, "I")
ActiveCell.Offset(1, 0).Select ' Step down 1 row to the next cell.
Loop
The first time the code is run, there is no error, only the second time. Closing and reopening Access "fixes" the problem. How can that be related to this code?