Adding two columns with equations in every other column using VBA

afletcher79

New Member
Joined
Feb 28, 2012
Messages
1
Hey
I hope someone can spare some time to help me with this. It's starting to hurt my brain.

I'm a novice user.
I'm part way through a macro to handle a data set and this has me stumped. I can't find a macro that works to add 2 columns in every other, and then to add (or copy) equations for specific rows, or should I handle that in a different sub?

So, what I want to do is:
For a cell with a number in it, I want to add two columns next to the number then refer to it (and others) in equations to fill a table of 2 columns and 5 rows. The equation would be something like =if(D7="","",D7+A7).

Below is the mini sheet with calculations in column DE and GH that I want to copy and paste for each data column.

Thanks in advance for any help, I really appreciate it.

Andy



Example_Workbook.xlsm
ABCDEFGHIJKL
1700.01
2Locations=11718192021
3Water Depth1010.51110.710.610.3
4KP1.2017075.735.93456.26386.50696.8286
5LocationVC-01VC-17VC-18VC-19VC-20VC-21
6Mudline00000
7Soft CLAY to2.6101.2117071101.2117071.41.41.2
812.61.211707111.211707
912.61.201707111.201707
10101.201707101.201707
11101.211707101.211707
12SAND4.512.61.211707  23.2
1314.51.211707  
1414.51.201707  
1512.61.201707  
1612.61.211707  
17Cemented Sand / Calcarenite    2.8
18    
19    
20    
21    
22
DPR Fence
Cell Formulas
RangeFormula
D7,D13,D18,G7,G13,G18D7=IF(C6="","",C6+$C$3)
E7:E8,E11:E13,E16:E18,E21,H7:H8,H11:H13,H16:H18,H21E7=IF(D7="","",$C$4+$B$1)
D8,G8D8=IF(AND(C6="",D7=""),"",C7+$C$3)
D9,D14,D19,G9,G14,G19D9=D8
E9:E10,E14:E15,E19:E20,H9:H10,H14:H15,H19:H20E9=IF(D9="","",$C$4)
D10,D15,D20,G10,G15,G20D10=D7
D11,D16,D21,G11,G16,G21D11=D7
D12,D17,G12,G17D12=IF(C12="","",MAX(D7:D11))
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,214,787
Messages
6,121,558
Members
449,038
Latest member
Guest1337

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