Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Here's a simple routine for LastRow, LastColumn
I put together a simple routine that will find the last Row and last Column w/ data in a spreadsheet
Without the pitfalls and limitations of End(xlup), End(xlDown) and "simple" UsedRange Any critique is welcomed Sub LstRow_LstColumn( Dim Rw As Range, Clm As Rang Dim x As Single, LRw As Single, LClm As Singl If WorksheetFunction.CountA(ActiveSheet.UsedRange) = 0 Then Exit Su With ActiveSheet.UsedRange D x = x + Set Rw = .Offset(.Rows.Count - x).Resize(1 Loop Until WorksheetFunction.CountA(Rw) < LRw = Rw.Ro x = D x = x + Set Clm = .Offset(0, .Columns.Count - x).Resize(, 1 Loop Until WorksheetFunction.CountA(Clm) < LClm = Clm.Colum End Wit End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Lastrow | Excel Worksheet Functions | |||
Lastrow | Excel Worksheet Functions | |||
Go to lastrow using other column's lastrow | Excel Programming | |||
Help with LastRow | Excel Programming | |||
LastRow issue | Excel Programming |