A macro that will change all column refs from one column to another?

  • Thread starter Thread starter ModelerGirl
  • Start date Start date
M

ModelerGirl

I have an array of cells that all refer to cells in column A (A30,A32
etc). I'd like to change all those references to C30,D32, etc.

Is there any way to do this? Because of other relative references i
the cells, just copying won't work.

Any help is greatly appreciated! Thanks again for all your help.

Kat
 
How would we know to change A30 to C30 and A32 to D32. Is there some ryhme
or reason to the pattern.

If you really meant change A to C.

for each cell in Selection
sForm = cell.Formula
sForm = Application.Substitute(sForm,"A","C")
cell.Formula = sForm
Next

The success of this approach would depend on the formulas in the cells. If
they contain "A"'s not associated with a cell address, then you might have
to be more discriminating. If the above would work, you could just use the
built in Replace command in the edit menu and skip the macro.
 
Back
Top