View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default finding last row number of UsedRange

You don't really need the numbers...

Dim myRow As Range
Dim myCell As Range
With ActiveSheet.UsedRange
For Each myRow In .Rows
For Each myCell In Intersect(.Cells, myRow)
'Do something to the cell
Next myCell
Next myRow
End With

One way to get the last row and column:

Dim lastRow As Long
Dim lastCol As Integer
With ActiveSheet.UsedRange
lastRow = .Cells(.Count).Row
lastCol = .Cells(.Count).Column
End With

In article ,
"Jamie Martin" wrote:

I want to loop through all the rows in my active worksheet's UsedRange. How
can I extract from the UsedRange Range object the numbers of the last row
and column?

Thanks everyone so much for your help--I really appreciate this community.

Jamie