Sub Project_6_EN(ByVal VecType, m, n, m1, n1 As Integer) ' 06_Unit vector_EN ' Updated: 27/03/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 6 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 to automate the download of the project. ' Note 3: The formulas and cell values generated here correspond only to the first 30 columns from INICIO to the right in the sheet. All your formulas and values are recommended to be written in these columns. ' Step 1. Go to the CONFIG sheet and add a short name and the number of your new project to the last row in the projects list. ' 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 = "=CONFIG!RC" 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 + 2).FormulaR1C1 = "=CONFIG!R5C4" Cells(m1 + 2, n1 + 3).FormulaR1C1 = "50" Cells(m1 + 2, n1 + 4).FormulaR1C1 = "=CONFIG!RC" Cells(m1 + 2, n1 + 5).FormulaR1C1 = "15" Cells(m1 + 2, n1 + 6).FormulaR1C1 = "=CONFIG!RC" Cells(m1 + 2, n1 + 7).FormulaR1C1 = "0" Cells(m1 + 3, n1 + 0).FormulaR1C1 = "a" Cells(m1 + 3, n1 + 2).FormulaR1C1 = "=CONFIG!RC" Cells(m1 + 3, n1 + 3).FormulaR1C1 = "200" Cells(m1 + 3, n1 + 4).FormulaR1C1 = "=CONFIG!RC" Cells(m1 + 3, n1 + 5).FormulaR1C1 = "15" Cells(m1, n1 + 9).FormulaR1C1 = "HELP" Dim HELPtxt As String HELPtxt = "VECTOR UNITARIO" & Chr(10) & _ " (See English version at the end)" & Chr(10) & _ " Un vector unitario es aquel cuyo m" & ChrW(243) & "dulo es igual a la unidad. Se puede construir un vector unitario u a partir de otro que no es unitario a con la f" & ChrW(243) & "rmula vectorial:" & Chr(10) & _ " u = a/|a|" & Chr(10) & _ " a= (ax, ay, az); u = (ux, uy, uz); |a| = raiz(ax^2 + ay^2 + az^2) En las celdas A10, B10 y C10 escriba las coordenadas iniciales del vector a, en A12, B12, C12 los incrementos de coordenadas en a. Las coordenadas del vector unitario u aparecer" & ChrW(225) & "n en A21 = u = a/|a| = ax/raiz(ax^2 + ay^2 + az^2) ; B21 = ay/raiz(ax^2 + ay^2 + az^2) y C21 = az/raiz(ax^2 + ay^2 + az^2). " & Chr(10) & _ " Cambie los valores de las coordenadas del vector a y con los botones de las coordenadas aprecie estos cambios desde diferentes " & ChrW(225) & "ngulos. " & Chr(10) & _ " (ENGLISH)" & Chr(10) & _ " UNIT VECTOR" & Chr(10) & _ " A unit vector is one whose module is equal to unity. A unit vector u can be constructed from another vector a that is not unit with the vector formula:" & Chr(10) & _ " u = a/|a|" & Chr(10) & _ " a= (ax, ay, az); u = (ux, uy, uz); |a| = root(ax^2 + ay^2 + az^2) In cells A10, B10 and C10 write the initial coordinates of the vector a, in A12, B12, C12 the coordinates of a. The coordinates of the unit vector u will appear in A21 = u = a/|a| = ax/root(ax^2 + ay^2 + az^2) ; B21 = ay/root(ax^2 + ay^2 + az^2) and C21 = az/root(ax^2 + ay^2 + az^2)." & Chr(10) & _ " Change the values " & ChrW(233) & "" & ChrW(233) & "of the coordinates of the vector a, and with the help of the coordinate buttons appreciate these changes from different angles." Cells(m1, n1 + 9).Comment.Text Text:=HELPtxt If m = m1 + 0 Then ' vector 2 Cells(m + 3, n + -1).FormulaR1C1 = "1" Cells(m + 3, n + 0).FormulaR1C1 = "a" Cells(m + 3, n + 2).FormulaR1C1 = "=CONFIG!RC" Cells(m + 3, n + 3).FormulaR1C1 = "200" Cells(m + 3, n + 4).FormulaR1C1 = "=CONFIG!RC" 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 = "Unit vector" Cells(m + 4, n + 12).FormulaR1C1 = "UNIT VECTOR OF ANY VECTOR" 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.3" Cells(m + 6, n + -1).FormulaR1C1 = "aox" Cells(m + 6, n + 0).FormulaR1C1 = "aoy" Cells(m + 6, n + 1).FormulaR1C1 = "aoz" Cells(m + 7, n + -1).FormulaR1C1 = "1" Cells(m + 7, n + 0).FormulaR1C1 = "1" Cells(m + 7, n + 1).FormulaR1C1 = "0" Cells(m + 7, n + 2).FormulaR1C1 = "<< ---" Cells(m + 7, n + 21).FormulaR1C1 = "1. Write the coordinates of any vector in the cells:" Cells(m + 8, n + -1).FormulaR1C1 = "ax" Cells(m + 8, n + 0).FormulaR1C1 = "ay" Cells(m + 8, n + 1).FormulaR1C1 = "az" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 9, n + -1).FormulaR1C1 = "0" Cells(m + 9, n + 0).FormulaR1C1 = "1" Cells(m + 9, n + 1).FormulaR1C1 = "2" Cells(m + 9, n + 2).FormulaR1C1 = "<< ---" Cells(m + 9, n + 22).FormulaR1C1 = "a_ox in cell A10" 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 = "a_oy in cell B10" 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 + 11, n + 22).FormulaR1C1 = "a_oz in cell C10" Cells(m + 3, n + 1).Interior.Color = "12611584" 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 = "u" Call AddNewVector End If ' vector ends If m = m1 + 9 Then ' vector 1 Cells(m + 3, n + -1).FormulaR1C1 = "2" Cells(m + 3, n + 0).FormulaR1C1 = "u" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 4, n + 22).FormulaR1C1 = "a_x in cell A12" 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_y in cell B12" Cells(m + 6, n + -1).FormulaR1C1 = "uox" Cells(m + 6, n + 0).FormulaR1C1 = "uoy" Cells(m + 6, n + 1).FormulaR1C1 = "uoz" Cells(m + 6, n + 22).FormulaR1C1 = "a_z in cell C12" 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 = "ux" Cells(m + 8, n + 0).FormulaR1C1 = "uy" Cells(m + 8, n + 1).FormulaR1C1 = "uz" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 8, n + 21).FormulaR1C1 = "2. The unit vector coordinates are calculated in cells A21, B21, and C21." Cells(m + 9, n + -1).FormulaR1C1 = "=R[-9]C/SQRT(R[-9]C^2+R[-9]C[1]^2+R[-9]C[2]^2)" Cells(m + 9, n + 0).FormulaR1C1 = "=R[-9]C/SQRT(R[-9]C[-1]^2+R[-9]C^2+R[-9]C[1]^2)" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-9]C/SQRT(R[-9]C[-2]^2+R[-9]C[-1]^2+R[-9]C^2)" Cells(m + 9, n + 2).FormulaR1C1 = "(Eq-6-1)" Cells(m + 9, n + 21).FormulaR1C1 = "3. Press the button located at D22 to view the unit vector component equations." 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 = "" Cells(m1 + 2, n1 - 1).Value = 2 End If ' vector ends If m = m1 + 9 Then Call BlackWhiteDesk Call PutEqBut End If ' actualizar hoja End Sub