I'm running some code to open up an excel book and clean it up before importing into access. This code works fine in a module, but is giving me some problems when I try to put it in the form and attach it to the button. I'm getting "The expression you entered contains invalid syntax" with possible reason's including an error evaluating a function, which is what I think is happening. I'm pretty sure the problem is with the following code:
This exact same code works fine in the module. Any ideas?
This
Code:
'finds the last row in the book to determine how many times to run loop.
dim lastrow as long
If WorksheetFunction.CountA(Cells) > 0 Then
lastrow = Cells.Find(what:="*", after:=[A1], _
searchorder:=xlByRows, _
SearchDirection:=xlPrevious).Row
End If
This exact same code works fine in the module. Any ideas?
This