Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default getting coordinates of a range


ok - spent over an hour on this so far with no luck ...(including google
newgroups)

I want to get the row number for each row in a range....so if a range has 30
rows starting at B3 then I want 3,4,5.....33 returned.

Is this possible? Probably easy but I'm missing it....

If this was access I would use the "for each row in myrange.rows"
collection and look at the property values to get this but I noticed excel
does not have a 'property' nor 'row' object.

Thanks

--
kent eilers



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default getting coordinates of a range

Hi

one way

Firstrow = Range("b3:b33").Cells(1).Row
'This give you the row number of the first cell in the range

Rcount = Range("b3:b33").Rows.Count + Firstrow
'This give you the last row in the range

Sub test()
Firstrow = Range("b3:b33").Cells(1).Row
LRow = Range("b3:b33").Rows.Count + Firstrow

For Rownumber = Firstrow To LRow Step 1
MsgBox Rownumber
'MsgBox Cells(Rownumber, "A").Value
Next
End Sub




--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Kent Eilers" wrote in message ...

ok - spent over an hour on this so far with no luck ...(including google
newgroups)

I want to get the row number for each row in a range....so if a range has 30
rows starting at B3 then I want 3,4,5.....33 returned.

Is this possible? Probably easy but I'm missing it....

If this was access I would use the "for each row in myrange.rows"
collection and look at the property values to get this but I noticed excel
does not have a 'property' nor 'row' object.

Thanks

--
kent eilers





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default getting coordinates of a range

woot !

thanks
))

"Ron de Bruin" wrote in message
...
Hi

one way

Firstrow = Range("b3:b33").Cells(1).Row
'This give you the row number of the first cell in the range

Rcount = Range("b3:b33").Rows.Count + Firstrow
'This give you the last row in the range

Sub test()
Firstrow = Range("b3:b33").Cells(1).Row
LRow = Range("b3:b33").Rows.Count + Firstrow

For Rownumber = Firstrow To LRow Step 1
MsgBox Rownumber
'MsgBox Cells(Rownumber, "A").Value
Next
End Sub




--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Kent Eilers" wrote in message

...

ok - spent over an hour on this so far with no luck ...(including google
newgroups)

I want to get the row number for each row in a range....so if a range

has 30
rows starting at B3 then I want 3,4,5.....33 returned.

Is this possible? Probably easy but I'm missing it....

If this was access I would use the "for each row in myrange.rows"
collection and look at the property values to get this but I noticed

excel
does not have a 'property' nor 'row' object.

Thanks

--
kent eilers







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default getting coordinates of a range

The following will give you an array that holds the number of each row.
Remember that Arrays start with element #0 by default:

a = Selection.Rows.Count
b = Selection.Row
ReDim array1(a)
For n = 0 To a - 1
array1(n) = b + n
Next n

- Piku

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default getting coordinates of a range

Well, it isn't Access but how about:

Sub test3000()
Dim myRange As Range, row
Set myRange = Range("b3:b32")
For Each row In myRange.Rows
Debug.Print row.Row
Next
End Sub

And for what it's worth, with 30 rows starting at b3 you want
3,4,5.....32 returned; and I wouldn't really use a variable named row,
the same as the name of an Excel Property.

Alan Beban

Kent Eilers wrote:
ok - spent over an hour on this so far with no luck ...(including google
newgroups)

I want to get the row number for each row in a range....so if a range has 30
rows starting at B3 then I want 3,4,5.....33 returned.

Is this possible? Probably easy but I'm missing it....

If this was access I would use the "for each row in myrange.rows"
collection and look at the property values to get this but I noticed excel
does not have a 'property' nor 'row' object.

Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default getting coordinates of a range


Thanks everyone for the help.

))

"Kent Eilers" wrote in message
...

ok - spent over an hour on this so far with no luck ...(including google
newgroups)

I want to get the row number for each row in a range....so if a range has

30
rows starting at B3 then I want 3,4,5.....33 returned.

Is this possible? Probably easy but I'm missing it....

If this was access I would use the "for each row in myrange.rows"
collection and look at the property values to get this but I noticed excel
does not have a 'property' nor 'row' object.

Thanks

--
kent eilers





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
Used to be able to attach range of labels to xy coordinates - no m 2007 Excels sucks99999[_2_] Charts and Charting in Excel 1 October 24th 09 11:06 AM
Coordinates 5F80YZ Excel Worksheet Functions 3 September 9th 09 12:47 AM
Are These Coordinates? [email protected] Charts and Charting in Excel 2 July 31st 06 08:28 PM
Converting MouseDown Coordinates to Chart Point Coordinates Steve[_50_] Excel Programming 3 December 2nd 03 06:48 PM
Cases/Set object to take coordinates of Print Range Bruce Roberson Excel Programming 6 July 28th 03 09:03 PM


All times are GMT +1. The time now is 05:29 PM.

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

About Us

"It's about Microsoft Excel"