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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top