Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
HLOOKUP - Relative cell reference in row index number | Excel Discussion (Misc queries) | |||
refer to cell relative to range | Excel Discussion (Misc queries) | |||
how can I return a value in excel that looks at a range of number | Excel Worksheet Functions | |||
how to return a certain value if a number is within a range | Excel Discussion (Misc queries) | |||
Macro to capture cell value then use it for a relative range selec | Excel Programming |