How can I get the last used column in a sheet???
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
-----Original Message-----
How can I get the last used column in a sheet???
.
|