Been trying to get LastRow in a matter that I can use it in several codes in the same module.
At the moment this is what I got:
Function getLastRow() As Long
Dim LRow As Long
endrow = 11
Do Until Cells(endrow + 1, 1).Value = ""
endrow = endrow + 1
Loop
getLastRow = LRow
End Function
The function is working but i get error 1004
on the line where i try to use it.
Sub PPP()
Application.ScreenUpdating = False
Call Unprotect
ActiveSheet.Range("$A$11:$AH$" & getLastRow).AutoFilter Field:=4, Criteria1:="PPP" '<--error occurs here
Call Protect
Application.ScreenUpdating = True
End Sub
Appreciate any help with this, or even better solutions.