I have a series of complex variable names (which can't simply be changed to 1,2,3,4 etc.) in the following form:
G0A1
G0A2
G0A3
G1A1
G1A2
G1A3
and so on,
(roughly 200 variables in each of 8 different worksheets of similar format).
All defined as:
Dim G0A1 as single
etc.
In my VBA code I calculate all of these variables, and now want to write the results to a worksheet. Currently I am just using the basic:
Dim j as integer
j=1
for j=1 to 50
sheets("sheet1").cells(1,j)=G0A1
sheets("sheet1").cells(2,j)=G0A2
etc.
next j
however I was wondering if it is possible to use a for loop and a string attachment to save me from typing all of these variables again. Below is basically what I'm looking for but can't seem to figure out how to implement.
Dim i as integer
Dim x as integer
x=1
For i=1 to 6
sheets("sheet1").cells(x,i)=G0A" & i
x=x+1
next i
The part in bold is where I'm trying to change the last character of the G0A1, G0A2,... as the variable i changes, but I can't figure out a way, and frankly I'm not even sure that it is possible.
Any ideas?
G0A1
G0A2
G0A3
G1A1
G1A2
G1A3
and so on,
(roughly 200 variables in each of 8 different worksheets of similar format).
All defined as:
Dim G0A1 as single
etc.
In my VBA code I calculate all of these variables, and now want to write the results to a worksheet. Currently I am just using the basic:
Dim j as integer
j=1
for j=1 to 50
sheets("sheet1").cells(1,j)=G0A1
sheets("sheet1").cells(2,j)=G0A2
etc.
next j
however I was wondering if it is possible to use a for loop and a string attachment to save me from typing all of these variables again. Below is basically what I'm looking for but can't seem to figure out how to implement.
Dim i as integer
Dim x as integer
x=1
For i=1 to 6
sheets("sheet1").cells(x,i)=G0A" & i
x=x+1
next i
The part in bold is where I'm trying to change the last character of the G0A1, G0A2,... as the variable i changes, but I can't figure out a way, and frankly I'm not even sure that it is possible.
Any ideas?