View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
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