Is there a function

  • Thread starter Thread starter Pubis
  • Start date Start date
P

Pubis

Is there a built in function in Excel or VBA that will
tell you the last used row and the last used column?
 
No.

However

Dim nLastCol As Long
Dim nLastRow As Long
With Cells.SpecialCells(xlCellTypeLastCell)
nLastRow = .Row
nLastCol = .Column
End With

or

Dim nLastCol As Long
Dim nLastRow As Long
With ActiveSheet.UsedRange
nLastRow = .Cells(.Count).Row
nLastCol = .Cells(.Count).Column
End With

come close.
 
Back
Top