Remove formula, copy range & Insert formula

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,213
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
My range is C2:AL12
There are 6 cells C2; I2; O2; U2; AA2 & AG2 which generates values.
Another 6 cells (below the above cells) C3; I3; O3; U3; AA3 & AG3 HasFormula & generates values.
Now, exactly 6 rows below C2 (i.e. C8) AND up to exactly 10 rows below C2 (i.e. C12) HasFormula & generates values of [R1C1] type like in C8=D8 & so on up to C12=D12.
Similarly for I2; O2; U2; AA2 & AG2; exactly 6 rows below I2 (i.e. I8) AND up to exactly 10 rows below I2 (i.e. I12) HasFormula & generates values of [R1C1] type like in I8=J8 & so on up to I12=J12 & so on till AG2.
There is a ‘control cell’ A4 which generates values & keeps on changing.

I need a Worksheet code which should perform the following actions:

If C2<=$A$4 then REMOVE THE FORMULAS from C3 AND ALSO FROM C8:C12 & so on till AG2.
Multiple IFs_1.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKAL
2303540455055
3303540455055
451
530
6
7
850505858999999888888777777666666
9323245454444444004006262550550
10111121213333333003004545450450
11787811112222222002002222350350
124242111111111001001515250250
13
14100
1599
16100
1799
T2
Cell Formulas
RangeFormula
C2C2=A5
C3,AG3,AA3,U3,O3,I3C3=C2
I2,AG2,AA2,U2,O2I2=C2+5
AG8:AG12,AA8:AA12,U8:U12,O8:O12,I8:I12,C8:C12C8=D8
A14:A15A14=A16


Fill C2:AG2 with MATCHED C2:AG2 (this happens if A5 gets changed). AND ALSO FILL exactly 6 rows below C2 (i.e. C8) AND up to exactly 10 rows below C2 (i.e. C12) which now does not HasFormula with the MATCHED C2:AG2 with the values of C8:C12 & so on.
Multiple IFs_1.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKAL
2152025303540
3152025303540
438MATCHEDMATCHEDMATCHED
515
6
7
8505058589999995088858777999666
932324545444444324004562444550
1011112121333333113002145333450
1178781111222222782001122222350
1242421111111142100115111250
13
14100
1599
16100
1799
T3
Cell Formulas
RangeFormula
C2C2=A5
I2,AG2,AA2,U2,O2I2=C2+5
A14:A15A14=A16


If A15>=A17, then INSERT THE FORMULA BACK in C2:AG2 as C2=C1 & son on till AG2=AG1 AND ALSO INSERT THE FORMULA BACK in C8:C12 as C8=D8 & C12=D12 & so on till AG8=AH8 & AG12=AH12 of [R1C1] type.
Multiple IFs_1.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH
2152025303540
3152025303540
444
515
6
7
850505858999999888888777777666666
9323245454444444004006262550550
10111121213333333003004545450450
11787811112222222002002222350350
124242111111111001001515250250
13
14100
15100
16100
17100
T4
Cell Formulas
RangeFormula
C2C2=A5
C3,AG3,AA3,U3,O3,I3C3=C2
I2,AG2,AA2,U2,O2I2=C2+5
AG8:AG12,AA8:AA12,U8:U12,O8:O12,I8:I12,C8:C12C8=D8
A14:A15A14=A16

How to achieve this?
 
Last edited:

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
2 typo errors in above thread:
Fill C3:AG3 with MATCHED C2:AG2 instead of Fill C2:AG2 with MATCHED C2:AG2
If A15>=A17, then INSERT THE FORMULA BACK in C3:AG3 as C3=C2 & son on till AG3=AG2 instead of If A15>=A17, then INSERT THE FORMULA BACK in C2:AG2 as C2=C1 & son on till AG2=AG1
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,234
Members
449,092
Latest member
SCleaveland

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