Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Building a Named Range in a formula with VBA

Results17 is the named range I am trying to "build" in my Vlookup.

------------
Dim week As Integer
week = InputBox("Enter the Week", Week) ' I type in 17

Range("B2").Formula = "=VLookup(A2, ""Results"" & week, 2, False)"

-------------

I get the Invalid Name error. If I remove the double-double quotes
around ""Results"", I get a compile error.

Please help

Thanks
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Building a Named Range in a formula with VBA

John,

Try this

Range("B2").Formula = "=VLookup(A2, Results" & week & ", 2, False)"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"John" wrote in message
...
Results17 is the named range I am trying to "build" in my Vlookup.

------------
Dim week As Integer
week = InputBox("Enter the Week", Week) ' I type in 17

Range("B2").Formula = "=VLookup(A2, ""Results"" & week, 2, False)"

-------------

I get the Invalid Name error. If I remove the double-double quotes
around ""Results"", I get a compile error.

Please help

Thanks
John



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
building formulas that change frequently using named cell ranges Sheldon Excel Worksheet Functions 4 December 6th 07 04:35 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
Formula for named range TUNGANA KURMA RAJU Excel Discussion (Misc queries) 2 July 1st 06 05:41 AM
named range into formula? heymoa Excel Worksheet Functions 4 May 22nd 06 02:05 PM
dynamically building references to named ranges [email protected] Excel Discussion (Misc queries) 1 January 3rd 06 10:23 PM


All times are GMT +1. The time now is 07:48 PM.

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"