'===================ABV PROJECT====================== '===================MODULE 1 ======================= Sub main () 'you can edit this macro to execute any command when loading this workbook 'next line call the routine that fill the sheet call absmain () End Sub 'Function not used if run inside abs (replaced by a builtin function) Sub absnc(row,col,formula) Cells(row,col).Formula=formula End sub Sub absmain() 'Do not edit this macro, changes will not be saved with the workbook!!! Dim objchart As Object Dim objbutton As Object Worksheets(1).Name = "TEST" Worksheets(2).Name = "B" Worksheets(3).Name = "C" Worksheets(1).Activate Columns("A").ColumnWidth = 1.857143 Columns("B").ColumnWidth = 25.285714 Columns("D").ColumnWidth = 5.714286 Columns("E").ColumnWidth = 5.714286 Columns("F").ColumnWidth = 5.714286 Columns("G").ColumnWidth = 5.714286 Columns("H").ColumnWidth = 5.714286 Columns("I").ColumnWidth = 5.714286 Columns("J").ColumnWidth = 6.857143 Columns("K").ColumnWidth = 5.714286 Columns("L").ColumnWidth = 5.714286 Columns("M").ColumnWidth = 5.714286 Columns("N").ColumnWidth = 6.857143 Columns("O").ColumnWidth = 6.857143 Columns("P").ColumnWidth = 5.714286 Rows("2").RowHeight = 46 Rows("3").RowHeight = 29 absnc(2,2,"'Welcome !") Cells(2,2).Font.Name = "Times" Cells(2,2).Font.Size = 24 Cells(2,2).Font.Bold = True Cells(2,2).HorizontalAlignment = xlCenter Cells(2,2).Font.ColorIndex = 14 Cells(3,2).Font.Name = "Times" Cells(3,2).Font.Size = 24 Cells(3,2).Font.Bold = True Cells(3,2).HorizontalAlignment = xlCenter absnc(5,2,"'Function:") Cells(5,2).Font.Name = "Courier" Cells(5,2).Font.Size = 14 Cells(5,2).Font.Bold = True Cells(5,2).Font.Italic = True Cells(5,2).Font.ColorIndex = 20 absnc(5,3,"'x =") Cells(5,3).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,3).Borders(xlEdgeLeft).LineStyle = xlLineStyleContinuous Cells(5,3).Font.Bold = True Cells(5,3).Interior.ColorIndex = 27 Cells(5,3).Font.ColorIndex = 9 absnc(5,4,"0") Cells(5,4).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,4).Interior.ColorIndex = 27 Cells(5,4).Font.ColorIndex = 17 Cells(5,4).NumberFormat = "0.00" absnc(5,5,"=+3.14/6+D5") Cells(5,5).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,5).Interior.ColorIndex = 27 Cells(5,5).Font.ColorIndex = 17 Cells(5,5).NumberFormat = "0.00" absnc(5,6,"=+3.14/6+E5") Cells(5,6).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,6).Interior.ColorIndex = 27 Cells(5,6).Font.ColorIndex = 17 Cells(5,6).NumberFormat = "0.00" absnc(5,7,"=+3.14/6+F5") Cells(5,7).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,7).Interior.ColorIndex = 27 Cells(5,7).Font.ColorIndex = 17 Cells(5,7).NumberFormat = "0.00" absnc(5,8,"=+3.14/6+G5") Cells(5,8).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,8).Interior.ColorIndex = 27 Cells(5,8).Font.ColorIndex = 17 Cells(5,8).NumberFormat = "0.00" absnc(5,9,"=+3.14/6+H5") Cells(5,9).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,9).Interior.ColorIndex = 27 Cells(5,9).Font.ColorIndex = 17 Cells(5,9).NumberFormat = "0.00" absnc(5,10,"=+3.14/6+I5") Cells(5,10).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,10).Interior.ColorIndex = 27 Cells(5,10).Font.ColorIndex = 17 Cells(5,10).NumberFormat = "0.00" absnc(5,11,"=+3.14/6+J5") Cells(5,11).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,11).Interior.ColorIndex = 27 Cells(5,11).Font.ColorIndex = 17 Cells(5,11).NumberFormat = "0.00" absnc(5,12,"=+3.14/6+K5") Cells(5,12).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,12).Interior.ColorIndex = 27 Cells(5,12).Font.ColorIndex = 17 Cells(5,12).NumberFormat = "0.00" absnc(5,13,"=+3.14/6+L5") Cells(5,13).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,13).Interior.ColorIndex = 27 Cells(5,13).Font.ColorIndex = 17 Cells(5,13).NumberFormat = "0.00" absnc(5,14,"=+3.14/6+M5") Cells(5,14).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,14).Interior.ColorIndex = 27 Cells(5,14).Font.ColorIndex = 17 Cells(5,14).NumberFormat = "0.00" absnc(5,15,"=+3.14/6+N5") Cells(5,15).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,15).Interior.ColorIndex = 27 Cells(5,15).Font.ColorIndex = 17 Cells(5,15).NumberFormat = "0.00" absnc(5,16,"=+3.14/6+O5") Cells(5,16).Borders(xlEdgeTop).LineStyle = xlLineStyleContinuous Cells(5,16).Borders(xlEdgeRight).LineStyle = xlLineStyleContinuous Cells(5,16).Interior.ColorIndex = 27 Cells(5,16).Font.ColorIndex = 17 Cells(5,16).NumberFormat = "0.00" absnc(6,3,"'sin(x) =") Cells(6,3).Borders(xlEdgeLeft).LineStyle = xlLineStyleContinuous Cells(6,3).Font.Bold = True Cells(6,3).Interior.ColorIndex = 27 Cells(6,3).Font.ColorIndex = 9 absnc(6,4,"=+sin(D$5)") Cells(6,4).Interior.ColorIndex = 27 Cells(6,4).Font.ColorIndex = 17 Cells(6,4).NumberFormat = "0.00" absnc(6,5,"=+sin(E$5)") Cells(6,5).Interior.ColorIndex = 27 Cells(6,5).Font.ColorIndex = 17 Cells(6,5).NumberFormat = "0.00" absnc(6,6,"=+sin(F$5)") Cells(6,6).Interior.ColorIndex = 27 Cells(6,6).Font.ColorIndex = 17 Cells(6,6).NumberFormat = "0.00" absnc(6,7,"=+sin(G$5)") Cells(6,7).Interior.ColorIndex = 27 Cells(6,7).Font.ColorIndex = 17 Cells(6,7).NumberFormat = "0.00" absnc(6,8,"=+sin(H$5)") Cells(6,8).Interior.ColorIndex = 27 Cells(6,8).Font.ColorIndex = 17 Cells(6,8).NumberFormat = "0.00" absnc(6,9,"=+sin(I$5)") Cells(6,9).Interior.ColorIndex = 27 Cells(6,9).Font.ColorIndex = 17 Cells(6,9).NumberFormat = "0.00" absnc(6,10,"=+sin(J$5)") Cells(6,10).Interior.ColorIndex = 27 Cells(6,10).Font.ColorIndex = 17 Cells(6,10).NumberFormat = "0.00" absnc(6,11,"=+sin(K$5)") Cells(6,11).Interior.ColorIndex = 27 Cells(6,11).Font.ColorIndex = 17 Cells(6,11).NumberFormat = "0.00" absnc(6,12,"=+sin(L$5)") Cells(6,12).Interior.ColorIndex = 27 Cells(6,12).Font.ColorIndex = 17 Cells(6,12).NumberFormat = "0.00" absnc(6,13,"=+sin(M$5)") Cells(6,13).Interior.ColorIndex = 27 Cells(6,13).Font.ColorIndex = 17 Cells(6,13).NumberFormat = "0.00" absnc(6,14,"=+sin(N$5)") Cells(6,14).Interior.ColorIndex = 27 Cells(6,14).Font.ColorIndex = 17 Cells(6,14).NumberFormat = "0.00" absnc(6,15,"=+sin(O$5)") Cells(6,15).Interior.ColorIndex = 27 Cells(6,15).Font.ColorIndex = 17 Cells(6,15).NumberFormat = "0.00" absnc(6,16,"=+sin(P$5)") Cells(6,16).Borders(xlEdgeRight).LineStyle = xlLineStyleContinuous Cells(6,16).Interior.ColorIndex = 27 Cells(6,16).Font.ColorIndex = 17 Cells(6,16).NumberFormat = "0.00" absnc(7,3,"'cos(x) =") Cells(7,3).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,3).Borders(xlEdgeLeft).LineStyle = xlLineStyleContinuous Cells(7,3).Font.Bold = True Cells(7,3).Interior.ColorIndex = 27 Cells(7,3).Font.ColorIndex = 9 absnc(7,4,"=+cos(D$5)") Cells(7,4).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,4).Interior.ColorIndex = 27 Cells(7,4).Font.ColorIndex = 17 Cells(7,4).NumberFormat = "0.00" absnc(7,5,"=+cos(E$5)") Cells(7,5).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,5).Interior.ColorIndex = 27 Cells(7,5).Font.ColorIndex = 17 Cells(7,5).NumberFormat = "0.00" absnc(7,6,"=+cos(F$5)") Cells(7,6).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,6).Interior.ColorIndex = 27 Cells(7,6).Font.ColorIndex = 17 Cells(7,6).NumberFormat = "0.00" absnc(7,7,"=+cos(G$5)") Cells(7,7).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,7).Interior.ColorIndex = 27 Cells(7,7).Font.ColorIndex = 17 Cells(7,7).NumberFormat = "0.00" absnc(7,8,"=+cos(H$5)") Cells(7,8).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,8).Interior.ColorIndex = 27 Cells(7,8).Font.ColorIndex = 17 Cells(7,8).NumberFormat = "0.00" absnc(7,9,"=+cos(I$5)") Cells(7,9).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,9).Interior.ColorIndex = 27 Cells(7,9).Font.ColorIndex = 17 Cells(7,9).NumberFormat = "0.00" absnc(7,10,"=+cos(J$5)") Cells(7,10).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,10).Interior.ColorIndex = 27 Cells(7,10).Font.ColorIndex = 17 Cells(7,10).NumberFormat = "0.00" absnc(7,11,"=+cos(K$5)") Cells(7,11).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,11).Interior.ColorIndex = 27 Cells(7,11).Font.ColorIndex = 17 Cells(7,11).NumberFormat = "0.00" absnc(7,12,"=+cos(L$5)") Cells(7,12).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,12).Interior.ColorIndex = 27 Cells(7,12).Font.ColorIndex = 17 Cells(7,12).NumberFormat = "0.00" absnc(7,13,"=+cos(M$5)") Cells(7,13).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,13).Interior.ColorIndex = 27 Cells(7,13).Font.ColorIndex = 17 Cells(7,13).NumberFormat = "0.00" absnc(7,14,"=+cos(N$5)") Cells(7,14).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,14).Interior.ColorIndex = 27 Cells(7,14).Font.ColorIndex = 17 Cells(7,14).NumberFormat = "0.00" absnc(7,15,"=+cos(O$5)") Cells(7,15).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,15).Interior.ColorIndex = 27 Cells(7,15).Font.ColorIndex = 17 Cells(7,15).NumberFormat = "0.00" absnc(7,16,"=+cos(P$5)") Cells(7,16).Borders(xlEdgeBottom).LineStyle = xlLineStyleContinuous Cells(7,16).Borders(xlEdgeRight).LineStyle = xlLineStyleContinuous Cells(7,16).Interior.ColorIndex = 27 Cells(7,16).Font.ColorIndex = 17 Cells(7,16).NumberFormat = "0.00" absnc(10,2,"'chart examples:") Cells(10,2).Font.Name = "Courier" Cells(10,2).Font.Size = 14 Cells(10,2).Font.Bold = True Cells(10,2).Font.Italic = True Cells(10,2).Font.ColorIndex = 20 Cells(13,2).Font.Name = "Courier" Cells(13,2).Font.Size = 14 Cells(13,2).Font.Bold = True Cells(13,2).Font.Italic = True Cells(13,2).Font.ColorIndex = 20 Set objchart = Worksheets("TEST").ChartObjects.Add(211,200,522,263) objchart.Activate ActiveChart.ChartType = xlLine ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).XValues = Range("D5:P5") ActiveChart.SeriesCollection(1).Name = "'sin (x)" ActiveChart.SeriesCollection(1).Values = Range("D6:P6") ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(2).Name = "'cos (x)" ActiveChart.SeriesCollection(2).Values = Range("D7:P7") ActiveChart.HasTitle = True ActiveChart.ChartTitle.Text = "'title" ActiveChart.Axes(xlCategory).HasTitle = True ActiveChart.Axes(xlCategory).AxisTitle.Text = "'X axis" ActiveChart.Axes(xlValue).HasMajorGridlines = True ActiveChart.Axes(xlValue ).HasTitle = True ActiveChart.Axes(xlValue ).AxisTitle.Text = "'Y axis" ActiveChart.Axes(xlCategory ).MaximumScale = 6.140000 ActiveChart.Axes(xlCategory ).MajorUnit = 1.570000 ActiveSheet.Shapes.AddShape(msoShapeOval,20, 15,169,72).Select Worksheets(2).Activate Worksheets(3).Activate Worksheets(1).Activate End Sub