I have a function to find the last used row of a column. It seems to work fine most of the time, however occasionally it get a value error.
here is the function, it is stored in the first module.
The actual cell has =LastOccupiedRow(A:A)
It usually happens after running a Macro that disables screen updating, hiding/un-hiding rows, for next loops ect
any suggestions
here is the function, it is stored in the first module.
VBA Code:
Public Function LastOccupiedRow(rData As Range)
LastOccupiedRow = rData.Find(What:="*", After:=rData.Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
End Function
It usually happens after running a Macro that disables screen updating, hiding/un-hiding rows, for next loops ect
any suggestions