'===================ABV PROJECT====================== '===================MODULE 1 ======================= Sub main () Dim objchart As Object Dim objbutton As Object Worksheets(1).Activate Set objbutton = ActiveSheet.Buttons.Add (670,100,96,31) 'rem debugprint(objbutton) objbutton.OnAction = "life" objbutton.Text = "next" Set objbutton = ActiveSheet.Buttons.Add (670,150,96,31) objbutton.OnAction = "next100" objbutton.Text = "Next 100" Set objbutton = ActiveSheet.Buttons.Add (670,200,96,31) objbutton.OnAction = "Randomize" objbutton.Text = "Randomize" for i = 1 to 26 Columns(i).ColumnWidth = 3.571429 next i for k = 1 to 26 Cells(k,1).Interior.ColorIndex = 14 Cells(k,26).Interior.ColorIndex = 14 Cells(1,k).Interior.ColorIndex = 14 Cells(26,k).Interior.ColorIndex = 14 next k Cells(10,10).Formula="1" Cells(10,11).Formula="1" Cells(10,12).Formula="1" Cells(11,10).Formula="1" Cells(11,11).Formula="1" Cells(12,10).Formula="1" Cells(12,11).Formula="1" Cells(12,12).Formula="1" Cells(10,14).Formula="1" Cells(10,15).Formula="1" Cells(10,16).Formula="1" Cells(11,14).Formula="1" Cells(11,15).Formula="1" Cells(12,14).Formula="1" Cells(12,15).Formula="1" Cells(12,16).Formula="1" Worksheets(1).Activate End Sub Sub next100() for i = 1 to 100 call life() call repaint() next i End sub Sub Randomize() for i = 2 to 25 for j = 2 to 25 Cells(i,j).Value = int( randbetween(0,1)) next j next i call life() end sub Sub life() for kk = 1 to 1 for i = 2 to 25 for j = 2 to 25 npar = 0.0 If Cells(i-1,j-1) > 0.0 Then npar = npar + 1 End If If Cells(i,j-1) > 0.0 Then npar = npar + 1 End If If Cells(i+1,j-1) > 0.0 Then npar = npar + 1 End If If Cells(i-1,j) > 0.0 Then npar = npar + 1 End If If Cells(i+1,j) > 0.0 Then npar = npar + 1 End If If Cells(i-1,j+1) > 0.0 Then npar = npar + 1 End If If Cells(i,j+1) > 0.0 Then npar = npar + 1 End If If Cells(i+1,j+1) > 0.0 Then npar = npar + 1 End If If Cells(i,j) > 0.0 Then If npar <2 or npar > 3 Then Cells(i+25,j+25).value = 0.0 Else Cells(i+25,j+25).value = Cells(i,j) + 1 End If End If If Cells(i,j)=0 and npar = 3 Then Cells(i+25,j+25).value = 1.0 End If next j next i for e = 2 to 25 for f = 2 to 25 Cells(e,f).value = Cells(e+25,f+25).value If Cells(e,f) > 9 Then Cells(e,f) = 0. End If Select Case Cells(e,f) Case 7 Cells(e,f).Interior.ColorIndex = 5 Cells(e,f).Font.ColorIndex = 5 Case 6 Cells(e,f).Interior.ColorIndex = 6 Cells(e,f).Font.ColorIndex = 6 Case 5 Cells(e,f).Interior.ColorIndex = 14 Cells(e,f).Font.ColorIndex = 14 Case 4 Cells(e,f).Interior.ColorIndex = 22 Cells(e,f).Font.ColorIndex = 22 Case 3 Cells(e,f).Interior.ColorIndex = 21 Cells(e,f).Font.ColorIndex = 21 Case 2 Cells(e,f).Interior.ColorIndex = 29 Cells(e,f).Font.ColorIndex = 29 Case 1 Cells(e,f).Interior.ColorIndex = 30 Cells(e,f).Font.ColorIndex = 30 Case 0 Cells(e,f).Interior.ColorIndex = 20 Cells(e,f).Font.ColorIndex = 20 Case Else Cells(e,f).Interior.ColorIndex = 4 Cells(e,f).Font.ColorIndex = 4 End Select next f next e repaint() next kk End Sub Sub absmain () 'Do not edit this macro, changes will not be saved with the workbook!!! Worksheets(1).Name = "Life" Worksheets(2).Name = "B" Worksheets(3).Name = "C" Worksheets(1).Activate End Sub