Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Select cells based on named Range and a column heading

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   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Select cells based on named Range and a column heading

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Select cells based on named Range and a column heading

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
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
Select Range based on column name and not A1 notations T.Vidak Excel Discussion (Misc queries) 3 July 16th 08 02:02 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
How to Select Range based on dates in cells Mike[_92_] Excel Programming 1 December 30th 04 03:53 AM
Formatting a range based on contents of column/row heading Chris Crowe Excel Programming 0 August 20th 03 06:15 PM
Formatting a range based on contents of column/row heading Chris Excel Programming 1 August 20th 03 05:06 PM


All times are GMT +1. The time now is 04:49 AM.

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"