[RESOLVED] macro inserting single quotes???
I am writing an Excel macro in 2007. I am trying to create a VLOOKUP() formula to insert into a cell. When the formula is inserted into the spreadsheet, the macro is putting single quotes around the cells in the range causing it not to work. I can't figure out why it is doing that.... any ideas?
Here is the line of code I am using to insert the formula.
vlookup Code:
Cells(.Row, .Column + 1) = "=VLOOKUP(RC[-1],chart!A2:B" & Format(Sheets("chart").Range("A2").End(xlDown).Row) & ",2,FALSE)"
And here is what it looks like in the Excel spreadsheet. (Notice the single quotes). It gives a #NAME error. When i remove the single quotes it works fine. I just don't understand why Excel is putting them in to begin with!
=VLOOKUP(A10,Chart!'A2':'B8812',2,FALSE)
I'm hoping this is obvious to someone... I cannot figure it out!!
Thank you for looking!
Re: macro inserting single quotes???
i can not tell you why, but it is an effect of using the rc[-1] part
Re: macro inserting single quotes???
Thank you! I replaced the RC[-1] with an actual cell reference and it works.
Thank again!