Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Return the row number of a cell relative to a range

Hi all,

Is it possible to return the location of cell relative to a range, for
example, to return cell B3 as row 1 relative to range A3:B5? I found that
the RangeObj.Row property return only the absolute row number. thanks a lot.

Frederick Chow
Hong Kong.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Return the row number of a cell relative to a range

Frederick,

range("B3").row - (range("B3:c5").Rows(1).row + 1)

hth,

Doug

"Frederick Chow" wrote in message
...
Hi all,

Is it possible to return the location of cell relative to a range, for
example, to return cell B3 as row 1 relative to range A3:B5? I found that
the RangeObj.Row property return only the absolute row number. thanks a

lot.

Frederick Chow
Hong Kong.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Return the row number of a cell relative to a range

Dong,

Thanks for your quick response but I don't think your suggestion will work
for both Range("B3").Row and Range("B3:C5").Rows(1).Row return 3....

Frederick Chow
"Doug Glancy" wrote in message
...
Frederick,

range("B3").row - (range("B3:c5").Rows(1).row + 1)

hth,

Doug

"Frederick Chow" wrote in message
...
Hi all,

Is it possible to return the location of cell relative to a range, for
example, to return cell B3 as row 1 relative to range A3:B5? I found that
the RangeObj.Row property return only the absolute row number. thanks a

lot.

Frederick Chow
Hong Kong.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Return the row number of a cell relative to a range

Frederick,

I misplaced a parentheses. Should have been:

range("B3").row - (range("a3:c5").Rows(1).row) + 1

As you say they both return 3. That's why I subtracted one from the other
and added 1. Try typing it into the immediate window (Ctl-G in the VBE):

? range("B3").row - (range("B3:c5").Rows(1).row + 1)

and you'll see that it returns 1, which is what you wanted.

hth,

Doug

"Frederick Chow" wrote in message
...
Dong,

Thanks for your quick response but I don't think your suggestion will work
for both Range("B3").Row and Range("B3:C5").Rows(1).Row return 3....

Frederick Chow
"Doug Glancy" wrote in message
...
Frederick,

range("B3").row - (range("B3:c5").Rows(1).row + 1)

hth,

Doug

"Frederick Chow" wrote in message
...
Hi all,

Is it possible to return the location of cell relative to a range, for
example, to return cell B3 as row 1 relative to range A3:B5? I found

that
the RangeObj.Row property return only the absolute row number. thanks a

lot.

Frederick Chow
Hong Kong.








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
HLOOKUP - Relative cell reference in row index number Nick Excel Discussion (Misc queries) 0 November 13th 09 12:50 PM
refer to cell relative to range Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 9 October 26th 07 03:03 PM
how can I return a value in excel that looks at a range of number Help in Excel Excel Worksheet Functions 1 March 9th 06 08:27 PM
how to return a certain value if a number is within a range Caconz Excel Discussion (Misc queries) 5 February 16th 06 04:33 AM
Macro to capture cell value then use it for a relative range selec PZ Straube Excel Programming 8 June 13th 05 08:28 AM


All times are GMT +1. The time now is 03:18 PM.

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"