I need to create a slew of 'INDEX' formulas that access arrays in many varied locations. I use code in my macro to figure out where the particular array is located and then I want it to write the appropriate 'INDEX' formula in the cell. Everything is working except that it is adding single quotes within the formula that cause it to be unrecognizable. Specifically this is an example:
The string that my macro builds looks like this:
=INDEX(Adams!E3:J7,1,1)
I store it in a variable called "Formula", then execute the following statement:
ActiveCell.Offset(0, z).FormulaR1C1 = Formula
What appears in the cell looks like this:
=INDEX(Adams!'E3':'J7',1,1)
Where are these quotes coming from and how do I get around this problem?
(I've used message boxes to confirm that the string doesn't initially contain these quotes.)
The string that my macro builds looks like this:
=INDEX(Adams!E3:J7,1,1)
I store it in a variable called "Formula", then execute the following statement:
ActiveCell.Offset(0, z).FormulaR1C1 = Formula
What appears in the cell looks like this:
=INDEX(Adams!'E3':'J7',1,1)
Where are these quotes coming from and how do I get around this problem?
(I've used message boxes to confirm that the string doesn't initially contain these quotes.)