Hi All

I'm in the process of creating a report which runs differently depending on the month. I've created various tables, and code which copies data across from one worksheet and puts it in the relevant month, such as the following:

Do Until IsEmpty(ActiveCell.Offset(1, -5))
ActiveCell.FormulaR1C1 = _
"=INDEX(Rankings!R1C3:R" & rownumberrankings & "C3,MATCH('SEO Keyword Rankings'!RC[-5],Rankings!R1C1:R" & rownumberrankings & "C1,0),1)"

ActiveCell.Offset(1, 0).Select
Loop


Depending on the month, the offset C number would increase by one - so April would be an increase of 4, for example. To do this, I'd like to be able to add a "dim" at the start of each month, and use something like RC[variable] so that it offsets according to whatever month it is.

Anyway, when I try and insert a variable, (e.g. 'SEO Keyword Rankings'!RC[&var&]), I get an error message. I've tried multiple ways of doing this, but can't get it to work.

So, two questions: What is the correct syntax for adding a variable like this to an equation? Is there a better way to do this?


Thanks in advance for all answers!