How to Randomize Slides in PowerPoint

Cover for How to Randomize Slides in PowerPoint

Randomizing slides in PowerPoint can be helpful for a number of reasons. This might help call out a specific individual randomly from the audience, help conduct a quiz, or shuffle slides to jump to a random topic. Randomizing onscreen questions can make some PowerPoint templates with quiz layouts more interesting. Unlike sorting slides manually via Slide Sorter view in PowerPoint, you can automatically shuffle random slides in PowerPoint.

How to Shuffle Slides in PowerPoint

Enable the Developer Tab in PowerPoint

To manually shuffle slides in PowerPoint, you can go to View -> Slide Sorter and drag slides to shuffle them. However, to do it manually, you must create a Macro. For this purpose, you will require the Developer tab in PowerPoint to be enabled. In case the tab isn’t visible, right-click anywhere on the Ribbon menu and select Customize the Ribbon.

Customizing the Ribbon in PowerPoint
Customizing the Ribbon in PowerPoint

Enable the Developer tab and click OK. This will show the tab on the Ribbon menu.

Enabling the Developer options in PowerPoint
Enabling the Developer options in PowerPoint

Create a Macro

From the Developer tab in PowerPoint, click Macros.

Developer tab in PowerPoint
Selecting create Macro in the Developer tab

Name the macro with a name and click Create.

Create a macro to randomize slides in PowerPoint
Create a macro to randomize slides in PowerPoint

Code to Shuffle Slides by Slide Number

Copy the code below and name the slide shuffle order according to need. For example, if you want slides 2-7 to shuffle, add 2 for the First Slide and 7 for the Last Slide in the code.

Sub ShuffleSlides()
FirstSlide = 2
LastSlide = 7

Randomize

For i = FirstSlide To LastSlide
    RSN = Int((LastSlide - FirstSlide + 1) * Rnd + FirstSlide)
    ActivePresentation.Slides(i).MoveTo (RSN)
Next i

End Sub
Macro for random slides in PowerPoint based on a fixed slide count
Macro for random slides in PowerPoint based on a fixed slide count

Code to Shuffle Slides when the Final Number of Slides is Uncertain

If your slide deck keeps changing and you’re not sure how many slides might be in it when you need to present the slide deck, add ‘ActivePresentation.Slides.Count’ for LastSlide in the code. You can copy the code below for use for the Macro. Select the FirstSlide according to the slide with which you wish to start the shuffle.

Sub ShuffleSlides()
FirstSlide = 2
LastSlide = ActivePresentation.Slides.Count

Randomize

For i = FirstSlide To LastSlide
    RSN = Int((LastSlide - FirstSlide + 1) * Rnd + FirstSlide)
    ActivePresentation.Slides(i).MoveTo (RSN)
Next i

End Sub
Macro for shuffle slides based on the active presentation slide
Macro for shuffle slides based on the active presentation slide

Test the Code in PowerPoint

To test the code, click the Run button to see how your slides will shuffle in PowerPoint using the Macro.

Testing the macro to shuffle PowerPoint slides
Testing the macro to debug

Create a Button to Shuffle Slides

Add a shape to your slide to create a button to automate the shuffling process. You can add any shape via Insert -> Shapes.

Adding a shape to a slide
Adding a shape to a slide

You can also label the button with text via Insert -> Text -> Text Box.

Adding a text box to create a button into a slide
Adding a text box to create a button into a slide

Once the button text is added, you can customize the colors and position on the slide according to need.

Creating a button in a PPT slide
Insert text into a button

Select the shape and go to Insert -> Links -> Action.

Adding an action to a button in PowerPoint
Adding an action to the button

From the dialog box, go to Run Macro and select the macro you created from the dropdown list. Click OK to close the dialog box and copy the button to any slide you would like to click on to shuffle slides. You can copy the button across all slides or just a single slide, according to need.

Enable the button to run a macro
The button can run a pre-made macro

Save the file as a macro-enable (PPTM format) via File -> Save As.

Export presentation to PPTM format
You need to select the PPTM format for PowerPoint

The below example shows the shuffle button in SlideShow mode in a macro-enabled PPTM file. To shuffle slides mid-presentation, open your PPTM file to present your slides and click the button to rearrange your defined slides automatically. For example, if you have set the macro to shuffle slides 2-7, clicking the button will randomize the slides from 2-7 by changing the sequence.

Button in action in Slideshow Mode
Button in action in Slideshow Mode

Final Words

Now that you know how to randomize slides in PowerPoint, you can try out the slide shuffling method mentioned above to create random sets of quizzes and other audience engagement slide decks. Suppose you are a teacher who needs to randomly call students for an activity or a presenter looking to engage the audience through random questions. In that case, the method mentioned above can be used to shuffle slides in PowerPoint during your presentation session. This method can also have many other uses; however, save your slide deck as a macro-enabled file to ensure your code isn’t erased.

Microsoft PowerPoint, PowerPoint Tools
Filed under