VBA to Split 2D plane measurements into 16 workbooks

JimBarrro

New Member
Joined
Apr 23, 2015
Messages
2
I have a main workbook and a main worksheet.The values I want changed in the work sheet are the four variables shown above under X and Y in the H and I columns.
I want to create 16 workbooks, each one determined by the geograpic location on the sheet shown in the diagram.They are numbered in the diagram:
m1, m2, m3....P4.
My Question is what is the formula (or area of code) for generating 16 workbooks with each workbook named or numbered (m1,m2 etc) and the variables changed only in the H and I columns as discussed and shown Below.
I have also attached some code that would be helpful in making the workbooks.
PHP:
Sub 2D Plane()

a = (Range("h3") - Range("h2")) / 4
b = (Range("i3") - Range("i2")) / 4
When X1 is present, then a+h2= new

X1 = a+Range("h2") , Range("h2")
X2 = 2*a+Range("h2") , a+Range("h2")
X3 = 3*a+Range("h2") , 2*a+Range("h2")
X4 = Range("h3") , 3*a+Range("h2")

Y1 = b+Range("i2") , Range("i2")
Y2 = 2*b+Range("i2") , b+Range("i2")
Y3 = 3*b+Range("i2") , 2*b+Range("i2")
Y4 = Range("i3") , 3*b+Range("i2")

X1,Y1 = M1
X1,Y2 = M2
X1,Y3 = M3
X1,Y4 = M4

X2,Y1 = N1
X2,Y2 = N2
X2,Y3 = N3
X2,Y4 = N4

X3,Y1 = O1
X3,Y2 = O2
X3,Y3 = O3
X3,Y4 = O4

X4,Y1 = P1
X4,Y2 = P2
X4,Y3 = P3
X4,Y4 = P4

End Sub
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,221,476
Messages
6,160,062
Members
451,615
Latest member
soroosh

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