Sub Project_27_EN(ByVal VecType, m, n, m1, n1 As Integer) ' 27_Loop in a Magnetic Field_EN ' Updated: 12/08/24 ' Created by: Ariel R. Becerra (21/11/23) ' Modified by: _________________ ' This is the code of your new project. ' Steps to embed the code to ScienSolar: ' Note 1: The number 27 in the name of this function must match the one in the list of the CONFIG sheet for this project. If not, please correct it. ' Note 2: This code will be integrated into the main code (into the VBA editor) to automate the download of the project. ' Note 3: The formulas and cell values generated here correspond only to the first 30 columns in the sheet. All your formulas and values are recommended to be written in these columns. ' Step 1. Go to the CONFIG sheet (at the end of column C) and add the number of your new project to the last row in the projects list, and a short name in the corresponding langage column. ' Step 2. Make sure that the list of projects in CONFIG sheet has the correct ascending numbering. ' Step 4. Open the VBA editor (Alt + F11 in Windows or Fn + Option + F11 in macOS). To avoid mistakes, make sure you only have one workbook open. ' Step 5. On the left, in the project explorer, select a non full module (or add a new one). ' Step 6. Select all the code in this file, copy and paste it at the end of the existing code in the module (or in the new one). ' Step 7. To load the project and to check it in a new sheet, go to the CONFIG sheet and click the New Sheet button, then select the project from the list and click the +Vector button. ' Step 8. Click any XYZ button to get the project in the coordinate system. Enjoy it! ' Visit www.sciensolar.com for news and updates of © ScienSolar. Cells(m1 - 1, n1 + 2).FormulaR1C1 = "1" Cells(m1 + 0, n1 + 2).FormulaR1C1 = "=CONFIG!R3C4" Cells(m1 + 0, n1 + 3).FormulaR1C1 = "850" Cells(m1 + 0, n1 + 6).FormulaR1C1 = "=CONFIG!R3C8" Cells(m1 + 0, n1 + 7).FormulaR1C1 = "8" Cells(m1 + 0, n1 + 8).FormulaR1C1 = "Ariel R. Becerra (21/11/23)" Cells(m1 + 1, n1 + 2).FormulaR1C1 = "=CONFIG!R4C4" Cells(m1 + 1, n1 + 3).FormulaR1C1 = "400" Cells(m1 + 1, n1 + 4).FormulaR1C1 = "x" Cells(m1 + 1, n1 + 5).FormulaR1C1 = "0" Cells(m1 + 1, n1 + 6).FormulaR1C1 = "=CONFIG!R4C8" Cells(m1 + 1, n1 + 7).FormulaR1C1 = "45" Cells(m1 + 2, n1 + 0).FormulaR1C1 = "t = 1,160156 s." Cells(m1 + 2, n1 + 2).FormulaR1C1 = "=CONFIG!R5C4" Cells(m1 + 2, n1 + 3).FormulaR1C1 = "40" Cells(m1 + 2, n1 + 4).FormulaR1C1 = "y" Cells(m1 + 2, n1 + 5).FormulaR1C1 = "15" Cells(m1 + 2, n1 + 6).FormulaR1C1 = "ngulo """ Cells(m1 + 2, n1 + 7).FormulaR1C1 = "0" Cells(m1 + 3, n1 + 0).FormulaR1C1 = "A" Cells(m1 + 3, n1 + 2).FormulaR1C1 = "=CONFIG!R6C4" Cells(m1 + 3, n1 + 3).FormulaR1C1 = "200" Cells(m1 + 3, n1 + 4).FormulaR1C1 = "z" Cells(m1 + 3, n1 + 5).FormulaR1C1 = "15" Cells(m1, n1 + 9).FormulaR1C1 = "HELP" Dim HELPtxt As String HELPtxt = "ESPIRA RECTANGULAR CON CORRIENTE EN UN CAMPO MAGN" & ChrW(201) & "TICO EXTERNO" & Chr(10) & _ " (See english version at the end)" & Chr(10) & _ " La fuerza que experimenta un vector elemento (o trozo) de corriente IL por parte de un campo magn" & ChrW(233) & "tico externo se expresa por la ecuaci" & ChrW(243) & "n vectorial:" & Chr(10) & _ " F = IL x B" & Chr(10) & _ " Si un alambre cerrado de forma rectangular con corriente est" & ChrW(225) & " compuesto de 4 partes rectil" & ChrW(237) & "neas, entonces cada parte experimenta una fuerza diferente en diferente direcci" & ChrW(243) & "n de acuerdo a la orientaci" & ChrW(243) & "n mutua del elemento de corriente y el campo externo, en donde elemento de corriente se llama al producto de la corriente por la longitud del alambre: IL y es un vector que va en direcci" & ChrW(243) & "n de la corriente. " & Chr(10) & _ " En el modelo, en la celda E9 puede modificar la magnitud y direcci" & ChrW(243) & "n de la corriente, en E11, E12, E13 la posici" & ChrW(243) & "n de la espira en el espacio; en E17, E18 y E19 las componentes del campo magn" & ChrW(233) & "tico externo, en E23 el tama" & ChrW(233) & "o de la espira. Con el bot" & ChrW(243) & "n 1 By 1 puede cambiar la orientaci" & ChrW(243) & "n de la espira con respecto al campo magn" & ChrW(233) & "tico y observar el comportamiento de las fuerzas magn" & ChrW(233) & "ticas sobre los segmentos de la espira. " & Chr(10) & _ " Con el bot" & ChrW(243) & "n Run puede hacer rotar la espira 360 grados y observar los cambios en las fuerzas. El bot" & ChrW(243) & "n Set to zero lleva la espira a la posici" & ChrW(243) & "n inicial. " & Chr(10) & _ " (ENGLISH)" & Chr(10) & _ " RECTANGULAR LOOP WITH CURRENT IN EXTERNAL MAGNETIC FIELD" & Chr(10) & _ " The force experienced by a current vector element (or piece) IL coming from an external magnetic field is expressed by the vector equation:" & Chr(10) & _ " F = IL x B" & Chr(10) & _ " If a rectangular closed wire with current is composed of 4 rectilinear parts, then each part experiences a different force in a different direction depending on the mutual orientation of the current element and the external field, where the current element is called the product of the current and the rectilinear cable element: IL and is a vector that goes in the direction of the current." & Chr(10) & _ " In the model, in cell E9 the magnitude and direction of the current can be modified, in E11, E12, E13 the position of the loop in space; in E17, E18 and E19 the components of the external magnetic field, in E23 the size of the loop. With the 1 By 1 button you can change the orientation of the loop with respect to the magnetic field and observe the behavior of the magnetic forces on the segments of the loop." & Chr(10) & _ " With the Run button, you can rotate the loop 360 degrees and watch the changes in forces. The Set to Zero button returns the loop to the starting position." On Error Resume Next Cells(m1, n1 + 9).Comment.Text Text:=HELPtxt If m = m1 + 0 Then ' vector 19 Cells(m + 3, n + -1).FormulaR1C1 = "1" Cells(m + 3, n + 0).FormulaR1C1 = "A" Cells(m + 3, n + 2).FormulaR1C1 = "=CONFIG!R6C4" Cells(m + 3, n + 3).FormulaR1C1 = "200" Cells(m + 3, n + 4).FormulaR1C1 = "z" Cells(m + 3, n + 5).FormulaR1C1 = "15" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 4, n + 2).FormulaR1C1 = "Current loop in a magnetic field" Cells(m + 4, n + 12).FormulaR1C1 = "CURRENT LOOP IN A MAGNETIC FIELD" Cells(m + 4, n + 24).FormulaR1C1 = "INSTRUCTIONS" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "4" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 7, n + -1).FormulaR1C1 = "0" Cells(m + 7, n + 0).FormulaR1C1 = "0" Cells(m + 7, n + 1).FormulaR1C1 = "2" Cells(m + 7, n + 2).FormulaR1C1 = "<< -- Position of the loop" Cells(m + 7, n + 4).FormulaR1C1 = "Current:" Cells(m + 7, n + 5).FormulaR1C1 = "-1" Cells(m + 8, n + -1).FormulaR1C1 = "=SIN(RADIANS(R[-6]C[8]))" Cells(m + 8, n + 0).FormulaR1C1 = "=1-COS(RADIANS(R[-6]C[7]))" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 8, n + 21).FormulaR1C1 = "The force experienced by a current element vector IL by an external magnetic field is expressed by " Cells(m + 9, n + -1).FormulaR1C1 = "=R20C7*R[9]C" Cells(m + 9, n + 0).FormulaR1C1 = "=R20C7*R[9]C" Cells(m + 9, n + 1).FormulaR1C1 = "=R20C7*R[9]C" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 9, n + 4).FormulaR1C1 = "Magnetic field:" Cells(m + 9, n + 21).FormulaR1C1 = "the vector equation:" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "1" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = " Bx =" Cells(m + 11, n + 5).FormulaR1C1 = "0" Cells(m + 11, n + 24).FormulaR1C1 = " F = IL x B." Cells(m + 3, n + 1).Interior.Color = "14408667" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "r" Call AddNewVector End If ' vector ends If m = m1 + 9 Then ' vector 18 Cells(m + 3, n + -1).FormulaR1C1 = "0" Cells(m + 3, n + 0).FormulaR1C1 = "r" Cells(m + 3, n + 4).FormulaR1C1 = " By =" Cells(m + 3, n + 5).FormulaR1C1 = "0" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 4, n + 4).FormulaR1C1 = " Bz =" Cells(m + 4, n + 5).FormulaR1C1 = "1" Cells(m + 4, n + 21).FormulaR1C1 = "If a closed rectangular wire with current is composed of 4 rectilinear parts, then each part experiences " Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0.3" Cells(m + 5, n + 21).FormulaR1C1 = "a different force in a different direction according to the mutual orientation of the current element " Cells(m + 6, n + 4).FormulaR1C1 = "Loop orientation:" Cells(m + 6, n + 21).FormulaR1C1 = "and the external field, where the product is called the current element. of the current times the length " Cells(m + 7, n + -1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 21).FormulaR1C1 = "of the wire, IL, and is a vector that goes in the direction of the current." Cells(m + 8, n + -1).FormulaR1C1 = "1" Cells(m + 8, n + 0).FormulaR1C1 = "1" Cells(m + 8, n + 1).FormulaR1C1 = "1" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 8, n + 4).FormulaR1C1 = " r =" Cells(m + 8, n + 5).FormulaR1C1 = "2" Cells(m + 9, n + -1).FormulaR1C1 = "=COS(RADIANS(RC[6]))*SIN(RADIANS(R[1]C[6]))" Cells(m + 9, n + 0).FormulaR1C1 = "=SIN(RADIANS(RC[5]))*SIN(RADIANS(R[1]C[5]))" Cells(m + 9, n + 1).FormulaR1C1 = "=COS(RADIANS(R[1]C[4]))" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 9, n + 4).FormulaR1C1 = " phi =" Cells(m + 9, n + 5).FormulaR1C1 = "90" Cells(m + 9, n + 21).FormulaR1C1 = "The model allows to qualitatively analyze the directions of the vectors involved in the phenomenon, in cell " Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = " theta =" Cells(m + 10, n + 5).FormulaR1C1 = "90" Cells(m + 10, n + 21).FormulaR1C1 = "G10 it can modify the magnitude and direction of the current, in G20, G21, G22 the orientation of the " Cells(m + 11, n + -1).FormulaR1C1 = "2" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1,5" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 11, n + 21).FormulaR1C1 = "loop in space; in G14, G15 and G16 the components of the external magnetic field, in G26 the size " Cells(m + 3, n + 1).Interior.Color = "16777075" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "phi" Call AddNewVector End If ' vector ends If m = m1 + 18 Then ' vector 17 Cells(m + 3, n + -1).FormulaR1C1 = "0" Cells(m + 3, n + 0).FormulaR1C1 = "phi" Cells(m + 3, n + 4).FormulaR1C1 = "Loop scale:" Cells(m + 3, n + 21).FormulaR1C1 = "of the loop. Press the simulation button >> to rotate the loop with respect to the magnetic field " Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 4, n + 21).FormulaR1C1 = "and observe the behavior of the magnetic forces on the loop segments." Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0.3" Cells(m + 5, n + 4).FormulaR1C1 = " A =" Cells(m + 5, n + 5).FormulaR1C1 = "2" Cells(m + 6, n + 21).FormulaR1C1 = "You can observe the movement and direction of forces from different perspectives with the XYZ, YZ, XZ, XY buttons." Cells(m + 7, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + 4).FormulaR1C1 = "Magnitude of the forces" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 8, n + 21).FormulaR1C1 = "Exercise:" Cells(m + 9, n + -1).FormulaR1C1 = "=-SIN(RADIANS(R[-9]C[6]))" Cells(m + 9, n + 0).FormulaR1C1 = "=COS(RADIANS(R[-9]C[5]))" Cells(m + 9, n + 1).FormulaR1C1 = "0" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 9, n + 4).FormulaR1C1 = "F1=" Cells(m + 9, n + 5).FormulaR1C1 = "=SQRT(R[117]C[-6]^2+R[117]C[-5]^2+R[117]C[-4]^2)" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "F2=" Cells(m + 10, n + 5).FormulaR1C1 = "=SQRT(R[134]C[-6]^2+R[134]C[-5]^2+R[134]C[-4]^2)" Cells(m + 10, n + 21).FormulaR1C1 = "1. Qualitatively identify the position of the most stable and least stable loop with respect to the magnetic field." Cells(m + 11, n + -1).FormulaR1C1 = "2" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1,5" Cells(m + 11, n + 4).FormulaR1C1 = "F3=" Cells(m + 11, n + 5).FormulaR1C1 = "=SQRT(R[124]C[-6]^2+R[124]C[-5]^2+R[124]C[-4]^2)" Cells(m + 11, n + 21).FormulaR1C1 = "2. In which positions is its potential energy maximum and in which is it minimum?" Cells(m + 3, n + 1).Interior.Color = "65535" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "theta" Call AddNewVector End If ' vector ends If m = m1 + 27 Then ' vector 16 Cells(m + 3, n + -1).FormulaR1C1 = "0" Cells(m + 3, n + 0).FormulaR1C1 = "theta" Cells(m + 3, n + 4).FormulaR1C1 = "F4=" Cells(m + 3, n + 5).FormulaR1C1 = "=SQRT(R[141]C[-6]^2+R[141]C[-5]^2+R[141]C[-4]^2)" Cells(m + 3, n + 21).FormulaR1C1 = "3. Search the literature for the formulas for torque and potential energy of the loop with current in a " Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 4, n + 21).FormulaR1C1 = "magnetic field and find the positions in which" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0.3" Cells(m + 5, n + 22).FormulaR1C1 = "a) the torque is maximum," Cells(m + 6, n + 22).FormulaR1C1 = "b) the torque is minimal," Cells(m + 7, n + -1).FormulaR1C1 = "=R[-18]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-18]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-18]C" Cells(m + 7, n + 22).FormulaR1C1 = "c) the torque has an intermediate value," Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 8, n + 22).FormulaR1C1 = "d) the potential energy is maximum," Cells(m + 9, n + -1).FormulaR1C1 = "=COS(RADIANS(R[-18]C[6]))*COS(RADIANS(R[-17]C[6]))" Cells(m + 9, n + 0).FormulaR1C1 = "=SIN(RADIANS(R[-18]C[5]))*COS(RADIANS(R[-17]C[5]))" Cells(m + 9, n + 1).FormulaR1C1 = "=-SIN(RADIANS(R[-17]C[4]))" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 9, n + 22).FormulaR1C1 = "e) the potential energy is minimal," Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 10, n + 22).FormulaR1C1 = "f) the potential energy has an intermediate value," Cells(m + 11, n + -1).FormulaR1C1 = "2" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1,5" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "16777215" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "µ" Call AddNewVector End If ' vector ends If m = m1 + 36 Then ' vector 15 Cells(m + 3, n + -1).FormulaR1C1 = "5" Cells(m + 3, n + 0).FormulaR1C1 = "µ" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "4" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 6, n + -1).FormulaR1C1 = "µox" Cells(m + 6, n + 0).FormulaR1C1 = "µoy" Cells(m + 6, n + 1).FormulaR1C1 = "µoz" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=SIGN(R[-38]C[6])*(R[-9]C+R[-37]C[1]*(R[-18]C[1]*R[-18]C*R[-9]C[1]-R[-18]C[1]*R[-18]C[1]*R[-9]C+R[-18]C[2]*R[-18]C*R[-9]C[2]-R[-18]C[2]*R[-18]C[2]*R[-9]C)+R[-37]C*(R[-18]C[1]*R[-9]C[2]-R[-18]C[2]*R[-9]C[1]))" Cells(m + 9, n + 0).FormulaR1C1 = "=SIGN(R[-38]C[5])*(R[-9]C+R[-37]C*(-R[-18]C[-1]*R[-18]C[-1]*R[-9]C+R[-18]C[-1]*R[-18]C*R[-9]C[-1]+R[-18]C[1]*R[-18]C*R[-9]C[1]-R[-18]C[1]*R[-18]C[1]*R[-9]C)+R[-37]C[-1]*(-R[-18]C[-1]*R[-9]C[1]+R[-18]C[1]*R[-9]C[-1]))" Cells(m + 9, n + 1).FormulaR1C1 = "=SIGN(R[-38]C[4])*(R[-9]C+R[-37]C[-1]*(-R[-18]C[-2]*R[-18]C[-2]*R[-9]C+R[-18]C[-2]*R[-18]C*R[-9]C[-2]-R[-18]C[-1]*R[-18]C[-1]*R[-9]C+R[-18]C[-1]*R[-18]C*R[-9]C[-1])+R[-37]C[-2]*(R[-18]C[-2]*R[-9]C[-1]-R[-18]C[-1]*R[-9]C[-2]))" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "2" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Call AddNewVector End If ' vector ends If m = m1 + 45 Then ' vector 14 Cells(m + 3, n + -1).FormulaR1C1 = "0" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=R[-27]C*R[-31]C[6]" Cells(m + 9, n + 0).FormulaR1C1 = "=R[-27]C*R[-31]C[5]" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-27]C*R[-31]C[4]" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "15773696" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Call AddNewVector End If ' vector ends If m = m1 + 54 Then ' vector 13 Cells(m + 3, n + -1).FormulaR1C1 = "7" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=R[-18]C[1]*R[-9]C[2]-R[-18]C[2]*R[-9]C[1]" Cells(m + 9, n + 0).FormulaR1C1 = "=-R[-18]C[-1]*R[-9]C[1]+R[-18]C[1]*R[-9]C[-1]" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-18]C[-2]*R[-9]C[-1]-R[-18]C[-1]*R[-9]C[-2]" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "0" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "1" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Call AddNewVector End If ' vector ends If m = m1 + 63 Then ' vector 12 Cells(m + 3, n + -1).FormulaR1C1 = "8" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 5, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 6, n + -1).FormulaR1C1 = "I2ox" Cells(m + 6, n + 0).FormulaR1C1 = "I2oy" Cells(m + 6, n + 1).FormulaR1C1 = "I2oz" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 8, n + -1).FormulaR1C1 = "I2x" Cells(m + 8, n + 0).FormulaR1C1 = "I2y" Cells(m + 8, n + 1).FormulaR1C1 = "I2z" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=R[-27]C[1]*R[-9]C[2]-R[-27]C[2]*R[-9]C[1]" Cells(m + 9, n + 0).FormulaR1C1 = "=-R[-27]C[-1]*R[-9]C[1]+R[-27]C[1]*R[-9]C[-1]" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-27]C[-2]*R[-9]C[-1]-R[-27]C[-1]*R[-9]C[-2]" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Call AddNewVector End If ' vector ends If m = m1 + 72 Then ' vector 11 Cells(m + 3, n + -1).FormulaR1C1 = "9" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 5, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 9, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "1" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Call AddNewVector End If ' vector ends If m = m1 + 81 Then ' vector 10 Cells(m + 3, n + -1).FormulaR1C1 = "10" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 5, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=-R[-27]C" Cells(m + 9, n + 0).FormulaR1C1 = "=-R[-27]C" Cells(m + 9, n + 1).FormulaR1C1 = "=-R[-27]C" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "=R[-18]C" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Call AddNewVector End If ' vector ends If m = m1 + 90 Then ' vector 9 Cells(m + 3, n + -1).FormulaR1C1 = "11" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 5, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 9, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "1" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Call AddNewVector End If ' vector ends If m = m1 + 99 Then ' vector 8 Cells(m + 3, n + -1).FormulaR1C1 = "12" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 5, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 6, n + -1).FormulaR1C1 = "I6ox" Cells(m + 6, n + 0).FormulaR1C1 = "I6oy" Cells(m + 6, n + 1).FormulaR1C1 = "I6oz" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 8, n + -1).FormulaR1C1 = "I6x" Cells(m + 8, n + 0).FormulaR1C1 = "I6y" Cells(m + 8, n + 1).FormulaR1C1 = "I6z" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=-R[-27]C" Cells(m + 9, n + 0).FormulaR1C1 = "=-R[-27]C" Cells(m + 9, n + 1).FormulaR1C1 = "=-R[-27]C" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "=R[-18]C" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Call AddNewVector End If ' vector ends If m = m1 + 108 Then ' vector 7 Cells(m + 3, n + -1).FormulaR1C1 = "13" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 5, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 9, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "1" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Call AddNewVector End If ' vector ends If m = m1 + 117 Then ' vector 6 Cells(m + 3, n + -1).FormulaR1C1 = "14" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 5, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 6, n + -1).FormulaR1C1 = "I8ox" Cells(m + 6, n + 0).FormulaR1C1 = "I8oy" Cells(m + 6, n + 1).FormulaR1C1 = "I8oz" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 8, n + -1).FormulaR1C1 = "I8x" Cells(m + 8, n + 0).FormulaR1C1 = "I8y" Cells(m + 8, n + 1).FormulaR1C1 = "I8z" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=R[-63]C" Cells(m + 9, n + 0).FormulaR1C1 = "=R[-63]C" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-63]C" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "=R[-18]C" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "B" Call AddNewVector End If ' vector ends If m = m1 + 126 Then ' vector 5 Cells(m + 3, n + -1).FormulaR1C1 = "15" Cells(m + 3, n + 0).FormulaR1C1 = "B" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 4, n + 1).FormulaR1C1 = "o[1]x=[-2;2]o2[1]y=[0;4]o3[1]z=[0;0]color=[0]origin[cart.]=[0;0;0]tfactor=0,001802885s" Cells(m + 5, n + -1).FormulaR1C1 = "26" Cells(m + 5, n + 0).FormulaR1C1 = "3" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 7, n + -1).FormulaR1C1 = "=R[1]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[1]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[1]C" Cells(m + 8, n + -1).FormulaR1C1 = "2" Cells(m + 8, n + 0).FormulaR1C1 = "4" Cells(m + 8, n + 1).FormulaR1C1 = "0" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Magnetic field position"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=R[-124]C[6]" Cells(m + 9, n + 0).FormulaR1C1 = "=R[-123]C[5]" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-122]C[4]" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Magnetic field"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "4" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "10498160" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "F1" Call AddNewVector End If ' vector ends If m = m1 + 135 Then ' vector 4 Cells(m + 3, n + -1).FormulaR1C1 = "16" Cells(m + 3, n + 0).FormulaR1C1 = "F1" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-81]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-81]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-81]C" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=ABS(R[-137]C[6])*(R[-81]C[1]*R[-9]C[2]-R[-81]C[2]*R[-9]C[1])" Cells(m + 9, n + 0).FormulaR1C1 = "=ABS(R[-137]C[5])*(-R[-81]C[-1]*R[-9]C[1]+R[-81]C[1]*R[-9]C[-1])" Cells(m + 9, n + 1).FormulaR1C1 = "=ABS(R[-137]C[4])*(R[-81]C[-2]*R[-9]C[-1]-R[-81]C[-1]*R[-9]C[-2])" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "11826222" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "F3" Call AddNewVector End If ' vector ends If m = m1 + 144 Then ' vector 3 Cells(m + 3, n + -1).FormulaR1C1 = "17" Cells(m + 3, n + 0).FormulaR1C1 = "F3" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-54]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-54]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-54]C" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=ABS(R[-146]C[6])*(R[-54]C[1]*R[-18]C[2]-R[-54]C[2]*R[-18]C[1])" Cells(m + 9, n + 0).FormulaR1C1 = "=ABS(R[-146]C[5])*(-R[-54]C[-1]*R[-18]C[1]+R[-54]C[1]*R[-18]C[-1])" Cells(m + 9, n + 1).FormulaR1C1 = "=ABS(R[-146]C[4])*(R[-54]C[-2]*R[-18]C[-1]-R[-54]C[-1]*R[-18]C[-2])" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "11826222" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "F2" Call AddNewVector End If ' vector ends If m = m1 + 153 Then ' vector 2 Cells(m + 3, n + -1).FormulaR1C1 = "18" Cells(m + 3, n + 0).FormulaR1C1 = "F2" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-81]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-81]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-81]C" Cells(m + 8, n + -1).FormulaR1C1 = "F2x" Cells(m + 8, n + 0).FormulaR1C1 = "F2y" Cells(m + 8, n + 1).FormulaR1C1 = "F2z" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=ABS(R[-155]C[6])*(R[-81]C[1]*R[-27]C[2]-R[-81]C[2]*R[-27]C[1])" Cells(m + 9, n + 0).FormulaR1C1 = "=ABS(R[-155]C[5])*(-R[-81]C[-1]*R[-27]C[1]+R[-81]C[1]*R[-27]C[-1])" Cells(m + 9, n + 1).FormulaR1C1 = "=ABS(R[-155]C[4])*(R[-81]C[-2]*R[-27]C[-1]-R[19]C[-1]*R[-27]C[-2])" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "11826222" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "F4" Call AddNewVector End If ' vector ends If m = m1 + 162 Then ' vector 1 Cells(m + 3, n + -1).FormulaR1C1 = "19" Cells(m + 3, n + 0).FormulaR1C1 = "F4" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-54]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-54]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-54]C" Cells(m + 8, n + -1).FormulaR1C1 = "F4x" Cells(m + 8, n + 0).FormulaR1C1 = "F4y" Cells(m + 8, n + 1).FormulaR1C1 = "F4z" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "=ABS(R[-164]C[6])*(R[-54]C[1]*R[-36]C[2]-R[-54]C[2]*R[-36]C[1])" Cells(m + 9, n + 0).FormulaR1C1 = "=ABS(R[-164]C[5])*(-R[-54]C[-1]*R[-36]C[1]+R[-54]C[1]*R[-36]C[-1])" Cells(m + 9, n + 1).FormulaR1C1 = "=ABS(R[-164]C[4])*(R[-54]C[-2]*R[-36]C[-1]-R[-54]C[-1]*R[-36]C[-2])" Cells(m + 9, n + 2).FormulaR1C1 = "=IF(R[-5]C[-1]>1,"" <-- Field formulae"","""")" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "11826222" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Cells(m1 + 2, n1 - 1).Value = 19 End If ' vector ends If m = m1 + 162 Then Call BlackWhiteDesk Call PutEqBut End If ' actualizar hoja End Sub