Animations for User Interfaces

How to create animations for user interfaces in Excel with VBA. Watch the video below:

Here’s the complete VBA code:

Sub test()

‘ test Macro
‘ Select 6 shapes


ActiveSheet.Shapes.Range(Array(“ovalGo”)).Select
Range(“L16”).Select
ActiveSheet.Shapes.Range(Array(“ovalStop”)).Select
Range(“K16”).Select
ActiveSheet.Shapes.Range(Array(“rectStop”)).Select
Range(“L16”).Select
ActiveSheet.Shapes.Range(Array(“rectGo”)).Select
Range(“L18”).Select
ActiveSheet.Shapes.Range(Array(“btnGO”)).Select
ActiveSheet.Shapes.Range(Array(“btnStop”)).Select
Range(“F14”).Select
End Sub

Sub btnGO()
ActiveSheet.Shapes.Range(Array(“btnGO”)).Visible = False
ActiveSheet.Shapes.Range(Array(“ovalGo”)).Visible = True
ActiveSheet.Shapes.Range(Array(“rectGo”)).Visible = True
ActiveSheet.Shapes.Range(Array(“btnStop”)).Visible = True
ActiveSheet.Shapes.Range(Array(“ovalStop”)).Visible = False
ActiveSheet.Shapes.Range(Array(“rectStop”)).Visible = False

End Sub

Sub btnStop()
ActiveSheet.Shapes.Range(Array(“btnGO”)).Visible = True
ActiveSheet.Shapes.Range(Array(“ovalGo”)).Visible = False
ActiveSheet.Shapes.Range(Array(“rectGo”)).Visible = False
ActiveSheet.Shapes.Range(Array(“btnStop”)).Visible = False
ActiveSheet.Shapes.Range(Array(“ovalStop”)).Visible = True
ActiveSheet.Shapes.Range(Array(“rectStop”)).Visible = True

End Sub