Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A macro that will change all column refs from one column to another?

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

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default A macro that will change all column refs from one column to another?

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.

--
Regards,
Tom Ogilvy

"ModelerGirl " wrote in message
...
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 in
the cells, just copying won't work.

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

Kate


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Macro change column contents James C[_2_] Excel Discussion (Misc queries) 4 January 25th 10 02:36 PM
Formulas change when macro adds new column Sandra Excel Worksheet Functions 3 January 23rd 09 11:25 PM
How do I change the row/column format in a macro to beyond letters? LunaMoon Excel Discussion (Misc queries) 3 August 4th 08 03:48 AM
macro to change multiple values in a column mrwawa Excel Discussion (Misc queries) 7 July 2nd 06 04:35 PM
Macro to change Chart Range when inserting a column Mark Charts and Charting in Excel 1 September 13th 05 01:12 PM


All times are GMT +1. The time now is 04:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"