View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Steve Drenker[_3_] Steve Drenker[_3_] is offline
external usenet poster
 
Posts: 5
Default Retrieving Values Saved in Names

Rob & Tom...thanks much for both techniques. Much simpler than iterating
over all 225+ names in my solution.

Steve

in article , Rob Bovey at
wrote on 3/3/06 6:58 PM:

Hi Steve,

If you're trying to get the name from within the same workbook where
it's defined then the following will work for a workbook-level name:

Dim lYear As Long
lYear = Application.Evaluate("Base_Year")

for a sheet-level name you'll need to specify the worksheet it belongs to:

lYear = Application.Evaluate("MySheet!Base_Year")

To retrieve the name from a different workbook you should fully qualify the
location of the name, like so:

lYear = Application.Evaluate("[Book1.xls]MySheet!Base_Year")