Friday, December 27, 2013

VBA - Finding last used row or column in Excel Worksheet

To do so we use the following lines, where mysheet is the worksheet you want to find these values for:
Dim mysheet as WorkSheet

Set mysheet = ActiveSheet

LastRow = mysheet.Cells(mysheet.Rows.Count, "A").End(xlUp).Row
LastCol = mysheet.Cells(1, mysheet.Columns.Count).End(xlToLeft).Column

No comments:

Post a Comment