Building a Named Range in a formula with VBA

J

John

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
 
B

Bob Phillips

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)
 
Top