Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default finding last row number of UsedRange

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default finding last row number of UsedRange

x = Cells.SpecialCells(xlCellTypeLastCell).Row
y = Cells.SpecialCells(xlCellTypeLastCell).Column

HTH,
Shockley

"Jamie Martin" wrote in message
...
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default finding last row number of UsedRange

Last column number in range:
MyRange.Columns(MyRange.Columns.Count).Column

Last row number in range
MyRange.Rows(MyRange.Rows.Count).Row

Bill Barclift



"Jamie Martin" wrote in message
...
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default finding last row number of UsedRange

Thanks. It sounds like Perl should not be the only language whose motto is
"There's more than one way to do it."

"J.E. McGimpsey" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is worksheet.usedrange empty? Sara Excel Worksheet Functions 2 August 24th 07 03:38 PM
Real Value of .UsedRange.Rows.Count dazman Excel Worksheet Functions 2 August 25th 05 03:24 PM
UsedRange problem Andy Excel Programming 2 September 18th 03 05:17 PM
Find Usedrange question Stuart[_5_] Excel Programming 2 August 31st 03 06:39 PM
Usedrange Terry VanDuzee Excel Programming 6 August 10th 03 05:57 PM


All times are GMT +1. The time now is 11:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"