How would I Detect the last column and the last row used in a worksheet? thanks!
Printable View
How would I Detect the last column and the last row used in a worksheet? thanks!
ActiveSheet.UsedRange.Select
Thats a start. i`m sure you can count the rows and columns.
Seahag
You might try this. It gives you the column in letter form (ie. A, B, C, ...) instead of numeric form (1, 2, 3, ...) & the row number.
Hope this helps.VB Code:
Dim strColRow() As String Dim strColumn As String Dim lngRow As Long 'Next statement is the same as doing an End-Home key combination ActiveCell.SpecialCells(xlLastCell).Select 'Splits out the address parts (col,row) into an array strColRow = Split(ActiveCell.Address, "$") 'Since address starts with '$', first element in strColRow array is null strColumn = strColRow(1) lngRow = strColRow(2)
Nate