End(xlUp) method to determine Last Row with Data, in one column


Sub LastRowWithData_xlUp_1()

Dim lastRow As Long

lastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row

MsgBox lastRow

End Sub



Sub LastRowWithData_xlUp_2()

Dim lastRow As Long

lastRow = ActiveSheet.Range("B" & Rows.Count).End(xlUp).Row

MsgBox lastRow

End Sub

Comments

Popular posts from this blog

50 Excel VBA Oral Interview Questions