I have a macro to set LastRow by finding last empty row in column B. However, sometimes the entire row is empty, except for Row 1 where the headers are. I need to set an IF statement on the LastRow variable to say IF Range B2 is NULL (or equals 0), then use B2 as parameter, to set LastRow. Else, find last row by .End(xlUp)
I've already tried different IF statements on my variable but all leads to an error message
Sub WeeklyGL()
'Set Variable Parameters for Monthly Sheet
Dim mySheet As String
Dim LastrowMonth As Integer
Dim mKey As Range
Dim mKeyrng As Range
Dim mValrng As Range
mySheet = Sheets("Weekly_GL").Range("AE1")
LastrowMonth = Sheets(mySheet).Range("B1048576").End(xlUp).Row --> this is where i need help
Set mKey = Sheets(mySheet).Range("AC1")
Set mKeyrng = Sheets(mySheet).Range("AC2:AC" & LastrowMonth)
Set mValrng = Sheets(mySheet).Range("AD2:AD" & LastrowMonth)
Last try: LastrowMonth = If Sheets(mySheet).Range("B2") ISNULL Then .Range("B2") Else Sheets(mySheet).Range("B1048576").End(xlUp).Row
If LastrowMonth = 1 Then LastrowMonth = 2
– Damian