Excel: VB Macro programming problem with formula writing
I am trying to enter addresses of cells in one worksheet ("source_sheet")
into a matrix of cells in a separate worksheet ("dest_sheet") using a
formula. I am using a nested for loop to fill the appropriate cells in
"dest_sheet". The code works properly in that it writes to the proper cells
in "dest_sheet". It does not work properly in that the formulas that are
written into the cells do not reference the correct addresses.
my write statement inside the for loops is:
Cells(write_row + j, 7).Formula = "='" & source_sheet & "'!r[" & read_col &
"]c[" & read_row & "]"
The resulting addresses refer to the proper sheet ("source_sheet"), but the
addresses of the cells are not correct.
An example formula is:
='raw data 25C'!G3
where 'raw data 25C' is accurate but G3 is not.
Am I misusing the RC cell reference?
HELP!
|