Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Friends,
I have a spreadsheet similar to the following: A B C 1 Symbol Quant PnL 2 DELL 50 3 INTC 100 4 AMD 200 I have a named Range "Symbol" for cells A2..A4. I want to select cells C2..C4 using the fact that they are in the column with the heading of "PnL" and that they correspond to the Range "Symbol". In other words, I want the code to say, "Select the cells that correspond to the Range "Symbol" but are in the column with the heading "PnL". Thanks, Alan -- achidsey |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Assuming your headings are in row 1 then try:
Dim fndCell As Range With Rows(1) Set fndCell = .Find("Pnl") If Not fndCell Is Nothing Then Range("Symbol").Offset(0, fndCell.Column - _ Range("Symbol").Column).Select End If End With Hope this helps Rowan "achidsey" wrote: Friends, I have a spreadsheet similar to the following: A B C 1 Symbol Quant PnL 2 DELL 50 3 INTC 100 4 AMD 200 I have a named Range "Symbol" for cells A2..A4. I want to select cells C2..C4 using the fact that they are in the column with the heading of "PnL" and that they correspond to the Range "Symbol". In other words, I want the code to say, "Select the cells that correspond to the Range "Symbol" but are in the column with the heading "PnL". Thanks, Alan -- achidsey |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Range("Symbol").Offset(,
WorksheetFunction.Match("PnL",Range("A1:Z1"),0)-1).Select -- Vasant "achidsey" (notmorespam) wrote in message ... Friends, I have a spreadsheet similar to the following: A B C 1 Symbol Quant PnL 2 DELL 50 3 INTC 100 4 AMD 200 I have a named Range "Symbol" for cells A2..A4. I want to select cells C2..C4 using the fact that they are in the column with the heading of "PnL" and that they correspond to the Range "Symbol". In other words, I want the code to say, "Select the cells that correspond to the Range "Symbol" but are in the column with the heading "PnL". Thanks, Alan -- achidsey |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rowan and Vasant,
Thanks much for the assistance. Alan -- achidsey "achidsey" wrote: Friends, I have a spreadsheet similar to the following: A B C 1 Symbol Quant PnL 2 DELL 50 3 INTC 100 4 AMD 200 I have a named Range "Symbol" for cells A2..A4. I want to select cells C2..C4 using the fact that they are in the column with the heading of "PnL" and that they correspond to the Range "Symbol". In other words, I want the code to say, "Select the cells that correspond to the Range "Symbol" but are in the column with the heading "PnL". Thanks, Alan -- achidsey |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Select Range based on column name and not A1 notations | Excel Discussion (Misc queries) | |||
inserting a named range into new cells based on a named cell | Excel Discussion (Misc queries) | |||
How to Select Range based on dates in cells | Excel Programming | |||
Formatting a range based on contents of column/row heading | Excel Programming | |||
Formatting a range based on contents of column/row heading | Excel Programming |