Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Access Named range value with multiple workbooks open

I am trying to access the value in a single cell that is a named range.

Code:

If Workbooks(Current).Names("UpDate_File_Name1").Valu e = "Save to" then
....

When I debug the .Value I get the cell address not the cell value; in
this case:

=Setup!$C$3 instead of "Save to" which is the value in the cell.

I can do:

If Activeworkbook.Worksheets("Setup").cells(3,3).valu e = "Save to"
then...

or

If Workbooks(Current).Worksheets("Setup").Cells(3, 3).Value = "Save to"
then...

and get the Value to be: "Save to"

I would like to use Named ranges in the VBA code.

Ken

  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Access Named range value with multiple workbooks open

Perhaps
Workbooks(Current).Names("UpDate_File_Name1").Refe rsToRange.Value

or
Range("Update_File_Name1").Value


" wrote:

I am trying to access the value in a single cell that is a named range.

Code:

If Workbooks(Current).Names("UpDate_File_Name1").Valu e = "Save to" then
....

When I debug the .Value I get the cell address not the cell value; in
this case:

=Setup!$C$3 instead of "Save to" which is the value in the cell.

I can do:

If Activeworkbook.Worksheets("Setup").cells(3,3).valu e = "Save to"
then...

or

If Workbooks(Current).Worksheets("Setup").Cells(3, 3).Value = "Save to"
then...

and get the Value to be: "Save to"

I would like to use Named ranges in the VBA code.

Ken


  #3   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Access Named range value with multiple workbooks open

This suggestion
Range("Update_File_Name1").Value

I believe will only work if the workbook containing that named range is the
activeworkook.

It appears the worksheet containing the named range would also have to be
qualified if the named range is in a workbook that is not active:
Workbooks(current).Worksheets("Sheet1").Range("UpD ate_File_Name1").Value

The RefersToRange may be a safer bet.

"JMB" wrote:

Perhaps
Workbooks(Current).Names("UpDate_File_Name1").Refe rsToRange.Value

or
Range("Update_File_Name1").Value


" wrote:

I am trying to access the value in a single cell that is a named range.

Code:

If Workbooks(Current).Names("UpDate_File_Name1").Valu e = "Save to" then
....

When I debug the .Value I get the cell address not the cell value; in
this case:

=Setup!$C$3 instead of "Save to" which is the value in the cell.

I can do:

If Activeworkbook.Worksheets("Setup").cells(3,3).valu e = "Save to"
then...

or

If Workbooks(Current).Worksheets("Setup").Cells(3, 3).Value = "Save to"
then...

and get the Value to be: "Save to"

I would like to use Named ranges in the VBA code.

Ken


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Access Named range value with multiple workbooks open

It is true the .Range substitution for .Name alone does not work.
Error.

The Range("Update_File_Name1").Value has the problem with having to be
the active workbook. As stated. Works but not with another workbook
active.

The Workbooks(Current).Names("UpDate_File_Name1").Refe rsToRange.Value
works perfectly.

I don't need the Worksheets("Sheet1"). quantifyer but will add it if I
expand beyond my current needs.

All very helpful. Impressive.........

Thanks,

Ken


JMB wrote:
This suggestion
Range("Update_File_Name1").Value

I believe will only work if the workbook containing that named range is the
activeworkook.

It appears the worksheet containing the named range would also have to be
qualified if the named range is in a workbook that is not active:
Workbooks(current).Worksheets("Sheet1").Range("UpD ate_File_Name1").Value

The RefersToRange may be a safer bet.

"JMB" wrote:

Perhaps
Workbooks(Current).Names("UpDate_File_Name1").Refe rsToRange.Value

or
Range("Update_File_Name1").Value


" wrote:

I am trying to access the value in a single cell that is a named range.

Code:

If Workbooks(Current).Names("UpDate_File_Name1").Valu e = "Save to" then
....

When I debug the .Value I get the cell address not the cell value; in
this case:

=Setup!$C$3 instead of "Save to" which is the value in the cell.

I can do:

If Activeworkbook.Worksheets("Setup").cells(3,3).valu e = "Save to"
then...

or

If Workbooks(Current).Worksheets("Setup").Cells(3, 3).Value = "Save to"
then...

and get the Value to be: "Save to"

I would like to use Named ranges in the VBA code.

Ken



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
2 excel workbooks open up from 1 file; named :1 and :2 - why? pkn Excel Discussion (Misc queries) 1 March 12th 10 03:55 PM
Link to Access & Named Range Jessica Excel Worksheet Functions 11 July 10th 09 02:34 PM
Named Range: Same Names, Multiple Workbooks with Same Sheet Name BEEJAY Excel Discussion (Misc queries) 4 November 7th 08 03:19 PM
Strange named range issue with multiple workbooks Adam White Excel Discussion (Misc queries) 0 November 14th 06 02:34 AM
Get the name of all workbooks open from access Xav[_2_] Excel Programming 3 December 15th 05 06:47 PM


All times are GMT +1. The time now is 12:13 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"