Text auto-replacement in a formula (similar to what dragging does)

hybrid_concept

New Member
Joined
May 28, 2012
Messages
15
So I have a fairly hefty formula that doesn't auto-fill the correct cells like simpler formulas would, if you dragged the corner of the cell across many. This formula uses VBAscript functions, and is:

=ColorFunction($C$4,Data!$C$450:$C$502,TRUE)+ColorFunction($C$4,Data!$H$450:$H$502,TRUE)+ColorFunction($C$4,Data!$M$450:$M$502,TRUE)

Basically, this function is first inserted on some row some ways down the C-column, and then needs to span across that same row over several columns to its right (D,E,F, etc, through to N). The part that needs to be replaced is "$C$4", which references cell C4 when the formula is is the C-column. The idea is to automagically change all three C4 references in the formula to D4 when the formula is input in the D column, etc, all the way through to the N-column.

As I said, merely dragging the corner of the starter cell does not work, it simply creates a verbatim copy of the entire formula over the many columns that it is dragged across, leaving it to be manually edited. Can this be done with VBA or is there another way?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Delete the $ from before the C, to make it C$4
 
Upvote 0
No problem :) Glad I could help (y) Appreciate the feedback!
 
Upvote 0

Forum statistics

Threads
1,219,162
Messages
6,146,660
Members
450,706
Latest member
LGVBPP

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top