Let's say I have a loop written, but need to Set lots of ranges for it to work. How can I set one range to contain cells that are spread out across a worksheet. Let's say in each row, I want to selected cells from column J, column S, column T.... all the way to column GB (5 columns between each). The pseudo-script I have goes something like this:
Sub CountPubs()
Dim i, j As Long
Dim Quant As Range
i = 2
j = 5
While i <= 400
Set Quant=Cells("I" & i),("I+j" & i),("I+2j" & i)...
So the Set line is terrible. The loop itself will increase i every time a condition is met, but I want the 36 cells spread out across row i, as defined by Quant, to increase too. How can I complete that Set Quant line in a way that will do this?
EDIT: In my testing, I can't even get a simpler version right. If I was just to make this go as far as T, I imagine the script would be:
Sub CountPubs()
Dim Count As Range
Dim i As Long
Dim Publications As Range
i = 2
Set Count = Range("C" & i)
Set Publications = Range("I" & i), ("O" & i), ("T" & i)
But this gives me a compile error, with the wrong number of arguments or invalid property assignment. Am I defining the last range incorrectly here?