How to make Number Points Counter Scoreboard in PowerPoint using VBA
❎ No animations! We are going to code the scoreboard counter in PowerPoint!
Sub PlusOne () counter.Caption = (counter.Caption) + 1 End Sub Sub MinusOne () counter.Caption = (counter.Caption) - 1 End Sub Sub ExitAndReset() counter.Caption = 0 ActivePresentation.SlideShowWindow.View.Exit End Sub
We need to run the above VBA Macro codes when we click on the triangle shapes in Slide Show Mode. To do this, select the shape, go to Insert | Actions | Run Macro | PlusOne (or) MinusOne
Now, go to Slide Show | From Beginning and click the shape, you will see that the code is triggered on the click of the triangle buttons and the counter increases or decreases by 1. You can also customise the counter’s colours and fonts.
How to create a Points Counter in PowerPoint?
We will be making a number counter in Microsoft PowerPoint which will be controlled by two buttons, one increases the value by 1 and the other decreases it by 1.
The following PowerPoint video tutorial describes the quick process of creating an interactive counter in PowerPoint and explains the VBA Code. We also add a button to reset the counter and exit Slide Show Mode.
Using VBA in PowePoint allows us to expand our scope. We can do a lot of interesting interactive activities from creating a football scoreboard to keeping scores for a PowerPoint Quiz Game across multiple slides. Following are a few popular requests and their corresponding VBA Codes.
Arrow Keys to Control Counter
The following VBA Code allows us to control the Label ActiveX Element’s caption through the arrow keys of our keyboard. In this tutorial, we shall be using the left arrow key to decrease the counter and the right arrow key to increase the counter.
We would need to use ActiveX Element Command Button to make this possible. If you want to find out more key-constants of VBA, you can click here.
Private Sub CommandButton1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If (KeyCode = vbKeyRight) Then Counter.Caption = (Counter.Caption) + 1 End If If (KeyCode = vbKeyLeft) Then Counter.Caption = (Counter.Caption) - 1 End If End Sub
Multiple Counters - Scoreboard
We will be making a multiple points counter scoreboard in PowerPoint. In this tutorial, we shall be having three labels and three buttons for each to control the points.
- Go to Insert | SmartArt and add a SmartArt which can be used for your PowerPoint Scoreboard. You can customize the design and the number of columns and rows. Remember to adjust the number of labels and shapes to be inserted accordingly.
- Add 3 labels from the Developer Tab and insert the corresponding shapes that will run macros to increase or decrease the counter.
- Write macros for each Label in the Visual Basic Editor and insert the suitable macro to the corresponding shape,
Sub Label1Plus2() Label1.Caption = (Label1.Caption) + 2 End Sub Sub Label1Plus1() Label1.Caption = (Label1.Caption) + 1 End Sub Sub Label1Minus1() Label1.Caption = (Label1.Caption) - 1 End Sub Sub Label1Reset() Label1.Caption = 0 End Sub 'similarly make for Label2, Label3 Sub ExitPPT() ActivePresentation.SlideShowWindow.View.Exit End Sub Sub Reset() Label1.Caption = 0 Label2.Caption = 0 Label3.Caption = 0 End Sub
Scoreboard Across Multiple Slides
We can easily add multiple scoreboard counters in all the selected slides of our PowerPoint Presentation and have the same values be present throughout our slide show mode. If you increase a label in Slide 1, the same change will be seen in Slide 2 too!
We use the same basic concept of increase the caption of a label (ActiveX component) but we place it in a slide-master. This allows for the same label to be present in all the PPT slides and allows for easy integration!
Insert the Labels in a Slide Layout inside the Slide Master. We need to have only one set of Labels. Do not have different Labels for all your different slides. That will cause lots of confusion and if their names overlap, it will cause your Macros to fail.
Double click the ActiveX Label to access the Visual Basic Applications Window. You’ll be within the Slide-Master in which the Label is present. Your code must also be within the same Slide-Master for the macros to run and change the caption of Labels which are also present within that slide-master.
Scoreboard in MacOS & Windows
Office for Mac doesn’t support ActiveX Element such as Labels which are used to create scoreboards in Windows. Hence, we are going to use the normal shapes to create the scoreboards and edit the text within the shape to make the interactive counter.
Insert shape named
counter1 in Slide 1 and type 0 within it. Use the following VBA code to increase the text within the shape
counter1. Add another shape which would run our macro
counter1Add on click (Select Shape > Insert > Action > Mouse Click > Run Macro >
Similarly, multiple counters can be created spanning across multiple slides, making it into a scoreboard. You can use it for quizzes or PowerPoint games such as Jeopardy.
Dim counter as TextRange Sub counterReset() For i = 1 To x 'Change Slide Range Set counter = ActivePresentation.Slides(i).Shapes("counter1").TextFrame.TextRange counter = 0 Set counter = ActivePresentation.Slides(i).Shapes("counter2").TextFrame.TextRange counter = 0 Next i End Sub Sub counter1Add() For i = 1 to x 'Change Slide Range Set counter = ActivePresentation.Slides(i).Shapes("counter1").TextFrame.TextRange counter = Int(counter) + 1 Next i End Sub