![]() |
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 |
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 |
All times are GMT +1. The time now is 02:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com