Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Excel Named Range

How can I address via vb the value stored in a named range cell.

example: on worksheet 3 I have a cell named variable 1

I want to retrive the value from that cell without going to it and selecting
it. Is there a way?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Excel Named Range

If Range(Variable_1) = "Blah" 'Spaces not allowed in named ranges
or
If [Variable_1] = "Blah"

HTH

Charles

Sandy wrote:
How can I address via vb the value stored in a named range cell.

example: on worksheet 3 I have a cell named variable 1

I want to retrive the value from that cell without going to it and selecting
it. Is there a way?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Excel Named Range

Either
val = Worksheets("worksheet 3").Range("rangename").Value
or
val = Names("rangename").RefersToRange.Value

should work.

This assumes Worksheet 3 is in the active workbook. If not
then you need to qualify the above by, for examnple,
val = Workbooks("Workbook1").Names("rangename").RefersTo Range.Value




Sandy wrote:
How can I address via vb the value stored in a named range cell.

example: on worksheet 3 I have a cell named variable 1

I want to retrive the value from that cell without going to it and selecting
it. Is there a way?

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Excel Named Range

Depends on rather the range name is workbook level or worksheet level

Workbook level syntax:

Workbooks("Book1.xls").Worksheets("Sheet1").Range( "RangeName")

Worksheet level syntax:

Workbooks("Book1.xls").Worksheets("Sheet1").Range( "Sheet1!RangeName")

Or when the worksheet's name has at least 1 space in it and it's a worksheet
level range name.

Workbooks("Book1.xls").Worksheets("Sheet 1").Range("'Sheet 1'!RangeName")


--
Ronald R. Dodge, Jr.
Production Statistician/Programmer
Master MOUS 2000

"Sandy" wrote in message
...
How can I address via vb the value stored in a named range cell.

example: on worksheet 3 I have a cell named variable 1

I want to retrive the value from that cell without going to it and

selecting
it. Is there a way?

Thanks



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Excel Named Range

good point, I forgot my quotes...
Range("Variable_1")

Charles

Andrew Taylor wrote:
Either
val = Worksheets("worksheet 3").Range("rangename").Value
or
val = Names("rangename").RefersToRange.Value

should work.

This assumes Worksheet 3 is in the active workbook. If not
then you need to qualify the above by, for examnple,
val = Workbooks("Workbook1").Names("rangename").RefersTo Range.Value




Sandy wrote:
How can I address via vb the value stored in a named range cell.

example: on worksheet 3 I have a cell named variable 1

I want to retrive the value from that cell without going to it and selecting
it. Is there a way?

Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 200
Default Excel Named Range

Sandy wrote:
How can I address via vb the value stored in a named range cell.

example: on worksheet 3 I have a cell named variable 1


No you don't; that's not a valid range name. If the range name of the
cell were variable1 (without the space) you can access it with
Range("variable1").value

Alan Beban


I want to retrive the value from that cell without going to it and selecting
it. Is there a way?

Thanks

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
Using named Excel range in VBA [email protected] Excel Discussion (Misc queries) 3 August 10th 07 04:13 AM
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
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM
Paste a named range to another range in Excel David Jean Excel Discussion (Misc queries) 2 April 13th 05 02:02 PM
Excel Named Range Question Bob Phillips[_6_] Excel Programming 0 May 14th 04 08:01 PM


All times are GMT +1. The time now is 12:01 AM.

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"