Sub Project_15(ByVal VecType, m, n, m1, n1 As Integer) ' Module to build trajectories ' This module is reserved for plotting trajectories that vectors make during a simulation or rotation of the axes. ' Credits: PhD. Ariel Becerra, Universidad de Pamplona, www.sciensolar.com 'definir el patr‹n de medida de los botones Dim PatronW As Double Dim PatronH As Double Cells(m + 1, n).Select PatronW = ActiveSheet.Cells(1, 1).Width PatronH = ActiveSheet.Cells(1, 2).Height PatronT = ActiveSheet.Cells(m + 7, n + 2).Top If m1 = m Then ' vector de referencia MsgBox "You must have at least one vector to graph its trajectory. The vector whose trajectory you want to graph will be added. Add again the module 15." ActiveSheet.Cells(m + 5, n + 1).FormulaR1C1 = 0 ' transparencia ActiveSheet.Cells(m + 7, n - 1).FormulaR1C1 = "0" ActiveSheet.Cells(m + 7, n).FormulaR1C1 = "0" ActiveSheet.Cells(m + 7, n + 1).FormulaR1C1 = "0" ActiveSheet.Cells(m + 9, n - 1).FormulaR1C1 = "4" ActiveSheet.Cells(m + 9, n).FormulaR1C1 = "4" ActiveSheet.Cells(m + 9, n + 1).FormulaR1C1 = "4" ActiveSheet.Cells(m1 + 1, n1 + 1).FormulaR1C1 = "GRF" 'para el pr‹ximo vector End If If m > m1 Then ' interface para la gr_fica ' a continuaci‹n se lee la lista de vectores i = 3 Do While Cells(m1 + i, n1 - 1) <> "" i = i + 9 If Cells(m1 + i + 1, n1).Value = "186" Then ' verificar si ya existe un m‹dulo para graficar. MsgBox "Ya existe un m‹dulo para graficar. Utilice el m‹dulo " _ & Cells(m1 + i, n1 - 1).Value & " para graficar cualquier vector. Se actualizar_ la lista de vecctores disponibles. " ActiveSheet.DropDowns("List2").Select With Selection ' actualizar la lista para incluir los vectores posteriores Do While .ListCount > 0 ' incluye los vectores depu_s del actual .ListIndex = .ListCount .RemoveItem (.ListIndex) Loop i = 3 Do While Cells(m1 + i, n1 - 1) <> "" ' incluye todos los vectores anteriores al m‹dulo de gr_fico .AddItem Cells(m1 + i, n1 - 1).Value i = i + 9 Loop MsgBox "Se ha actualizado la lista en el m‹dulo de gr_fica." End With Cells(m1 + i + 1, n1 - 1).Select GoTo fin End If Loop 'bot‹n Nuevo ActiveSheet.Buttons.Add(PatronW * (n - 1), PatronT + 32, PatronW * 2, PatronH - 2).Select ' agrega el bot‹n de gr_fica Selection.name = "ResetGraph" Selection.Characters.Text = "Reset graph" Selection.OnAction = "DeleteGraphFunction" 'introducir lista desplegable ActiveSheet.DropDowns.Add(PatronW * (n + 1 / 3), PatronT, PatronW / 2, PatronH).Select With Selection .name = "List2" .LinkedCell = "CONFIG!$V$6" .DropDownLines = 8 .Display3DShading = True .AddItem "1" ' valor 1 i = 12 Do While Cells(m1 + i + 9, n1 - 1) <> "" ' incluye todos los vectores anteriores al m‹dulo de gr_fico .AddItem Cells(m1 + i, n1 - 1).Value i = i + 9 Loop End With ActiveSheet.Cells(m + 3, n + 1).Select ' color del vector With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 10092543 .TintAndShade = 0 .PatternTintAndShade = 0 End With 'datos de la forma libre: ActiveSheet.Cells(m + 6, n - 1).Value = "Choose the vector to make its graphic:" ActiveSheet.Cells(m + 8, n - 1).Value = "Max. steps:" ActiveSheet.Cells(m + 8, n).Value = ActiveSheet.Cells(m1 + 1, n1 + 7).Value + 5 ActiveSheet.Cells(m + 7, n - 1).Value = "" ActiveSheet.Cells(m + 6, n).Value = "" ActiveSheet.Cells(m + 6, n + 1).Value = "" ActiveSheet.Cells(m + 8, n + 1).Value = "" ActiveSheet.Cells(m + 5, n + 1).FormulaR1C1 = 0 ' transparencia ActiveSheet.Cells(m + 4, n).FormulaR1C1 = "186" ActiveSheet.Cells(m + 7, n).FormulaR1C1 = "" ActiveSheet.Cells(m + 7, n + 1).FormulaR1C1 = "" ActiveSheet.Cells(m + 9, n - 1).FormulaR1C1 = "" ActiveSheet.Cells(m + 9, n).FormulaR1C1 = "" ActiveSheet.Cells(m + 9, n + 1).FormulaR1C1 = "" ActiveSheet.Cells(m + 10, n + 2).Value = "<-- To keep the graph insert 2." ActiveSheet.Cells(m + 3, n).Value = "" ActiveSheet.Cells(m + 10, n + 3).FormulaR1C1 = "" ActiveSheet.Cells(m + 11, n + 3).FormulaR1C1 = "" ActiveSheet.Cells(m + 4, n + 2).FormulaR1C1 = "To plot a graph:" ActiveSheet.Cells(m + 5, n + 2).FormulaR1C1 = "1. Max. steps = lenght of the graph." ActiveSheet.Cells(m + 6, n + 2).FormulaR1C1 = "2. Click Reset graph." ActiveSheet.Cells(m + 7, n + 2).FormulaR1C1 = "3. Choose in combo box a vector." ActiveSheet.Cells(m + 8, n + 2).FormulaR1C1 = "4. Run simulation or rotate." ActiveSheet.Cells(m + 9, n + 2).FormulaR1C1 = "" ActiveSheet.Cells(m + 11, n - 1).FormulaR1C1 = "1" 'formato de la caja de conifg Range(Cells(m + 4, n - 1), Cells(m + 11, n + 1)).Select With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlMedium End With Selection.Borders(xlInsideVertical).LineStyle = xlYes With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorDark1 .TintAndShade = -0.1 .PatternTintAndShade = 0 End With fin: End If End Sub