I am attempting to create a named range at run time by concatenating
strings and converting integer variables to strings. In this piece of
code, the string variable "Range_String" gives me a valid string (in
the watch window), but when I use it as an argument to add a new named
range to the worksheet I get an error. I know it has something to do
with using quotations in strings and formulas and can somehow can be
dealt with by employing single quotes in strategic places. However, I
can't quite get it to work.
Range_Name = "First"
Start = 1
'the active worksheet is named "Data_Sheet"
Range_String = "=Data_Sheet!$a$" & Str(start) & ":$c$20"
'trying to acheive "=Data_Sheet!$a$1:$c$20"
ActiveWorkbook.Names.Add Name:=Range_Name, RefersTo:=Range_String
Can anyone help?