Hi,
Suppose i’m using a loop to enter values into certain cells but the positioning of these have a sequence. For example, I’m trying to put values in C5, E5, G5, I5, C10, E10, G10, I10 etc, what I’ve done is add 2 helper columns that hold the row indexes and columns indexes e.g. rows 5, 5, 5, 5, 10, 10, 10, 10 and columns 3, 5, 7, 9, 3, 5, 7, 9.
Whats the method to store these in VBA rather than helper columns incase they got deleted?
Is it something like and referencing through this? Not entirely sure. If you need more clarity then let me know.
Dim ArrRow(5,5,5,5,10,10,10,10) as string, ArrCol(3,5,7,9,3,5,7,9) as string
My code goes along the lines of..
Suppose i’m using a loop to enter values into certain cells but the positioning of these have a sequence. For example, I’m trying to put values in C5, E5, G5, I5, C10, E10, G10, I10 etc, what I’ve done is add 2 helper columns that hold the row indexes and columns indexes e.g. rows 5, 5, 5, 5, 10, 10, 10, 10 and columns 3, 5, 7, 9, 3, 5, 7, 9.
Whats the method to store these in VBA rather than helper columns incase they got deleted?
Is it something like and referencing through this? Not entirely sure. If you need more clarity then let me know.
Dim ArrRow(5,5,5,5,10,10,10,10) as string, ArrCol(3,5,7,9,3,5,7,9) as string
My code goes along the lines of..
Code:
Set RNG = Sheets(1).Range(“A2:A21”)
For Each c in RNG
StartRow = c.offset(,-6) ‘where helper row index is stored
StartCol = c.offset(,7) ‘where helper column index is stored
’code inserted here using .cells(StartRow, StartCol)
Next c