View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan[_2_] Rowan[_2_] is offline
external usenet poster
 
Posts: 226
Default Select cells based on named Range and a column heading

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