Excel2000: Reading Named Range value from VBA

  • Thread starter Thread starter Arvi Laanemets
  • Start date Start date
A

Arvi Laanemets

Hi

Is it possible at all, and when yes, then how? To be more specific, I want
to write an workbook Open event, where I need the current weeknumber string
in format "yyyy.ww". There is a named range/function CurrWeek defined in
workbook, which returns exactly the value I need, but how do I get it? I
checked with Watch window, and the expression:
ActiveWorkbook.Names("CurrWeek")
doesn't return "2004.28" today - instead it returns
"=INDEX(Weeks_Week,MATCH(VLOOKUP(TODAY(),Weeks_Start,1,1),Weeks_Start,0))"
i.e. the 'Refers To' part of name definition (Weeks_Week and Weeks_Start are
named ranges which do return ranges from a table). And the same with:
ActiveWorkbook.Names("CurrWeek").Value
 
Hi Arvi,

try either
[CurrWeek]

or
Application.evaluate("CurrWeek")


regards
Charles
______________________
Decision Models
The Excel Calculation Site.
www.DecisionModels.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top