How can I get the last used column in a sheet???

  • Thread starter Thread starter monika
  • Start date Start date
There's an example on the "Last Row/Col in Worksheet" page on my website
 
One might use the UsedRange property of the worksheet.
This is the range that has been used, but is only
refreshed on saving & re-opening. It is useful though.

The UsedRange has two properties. Columns.Count and
Rows.Count that return the UsedRange width and
height...ie columns and rows. BUT you need to know where
the UsedRange starts, so you'll need the Column and Row
values too.

So, on a spreadsheet...

With Activesheet.usedRange
LastRowUsed = .Row + .Rows.Count -1
LastColumnUsed = .Column +.Columns.Count -1
End With

Patrick Molloy
Microsoft Excel MVP
 

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