Sometimes, you may want to add an element of surprise to your PowerPoint presentation by shuffling the slides randomly. For example, perhaps you create a presentation for your students and want to shuffle some or all of the flashcards.
By default, PowerPoint doesn’t have a built-in feature for this, but you can achieve it using a macro. In this step-by-step guide, we’ll show you how to shuffle slides manually and how to use a VBA code to automate the random shuffling process.
How to Manually Shuffle Slides in PowerPoint
In Microsoft PowerPoint, you can manually shuffle the slides in your presentation to display them in random order using the “Slide Sorter” view. While this method may not be as random as using macros, it still allows you to rearrange the slides in a different order.
To manually shuffle and randomize the slides in a PowerPoint presentation, follow the steps below.
- Open your PowerPoint presentation and go to the View tab in the ribbon menu at the top of the screen. Click on it to access the View menu.
- In the View menu, look for the Presentation Views group, and select the Slide Sorter option. This will switch your presentation to the Slide Sorter view, where you can see all the slide thumbnails at once.
- In the Slide Sorter view, you may see larger thumbnails of the slides. If you have a lot of slides in your presentation, click on the Zoom Out option represented by the – icon at the bottom toolbar to get a better overview of all the slides. Keep clicking on it until you can see all the slides in the presentation on the screen at once.
- Now, you can easily shuffle the slides by clicking on a slide and dragging it to a random position on the screen. Repeat this step with other slides to shuffle them randomly. Continue rearranging the slides until you are satisfied with the new order.
Keep in mind that this method doesn’t guarantee a completely random order, as it depends on your manual arrangement. If you want to see a completely random slide appear after you hit the button to show the next slide, you can use the VBA macros method for more precise and automated random shuffling.
How to Randomize PowerPoint Slides Using a VBA Code
To make sure your PowerPoint slides are playing in completely random order, you’ll need to use a little bit of coding. The Macros option in Microsoft Office PowerPoint allows you to run VBA codes to automatically shuffle the slides in your presentation.
In this tutorial, we’ll show you how to shuffle your slides with no duplicates. To randomize slides in PowerPoint so that the same slide doesn’t repeat itself, follow the steps below.
- To get started, you’ll need to access the Developer tab on your PowerPoint ribbon menu. To do that, follow the path File > Options or right-click in any empty space in the ribbon menu and select Customize the Ribbon. This will open a dialog box.
- In the PowerPoint Options dialog box, scroll down until you find the Developer option. Check the box next to Developer and click OK.
- Now select the Developer tab and choose Macros. In the pop-up window, you can insert a new Macro. Choose a name for it (for example, Shuffleslides) and click Create to continue.
- This will open the Visual Basic Editor window, where you can input the code to randomize your PowerPoint presentation slides.
- Copy the following VBA code and paste it into the open Visual Basic window.
Sub Shuffleslides()
FirstSlide = 2
LastSlide = 5
Randomize
‘generate a random no between first slide and last slide’
GRN:
RSN = Int((LastSlide – FirstSlide + 1) * Rnd + FirstSlide)
If RSN = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex Then GoTo GRN
ActivePresentation.SlideShowWindow.View.GotoSlide (RSN)
End Sub
- After pasting the code, you’ll notice that the default setting shuffles slides 2 through 5. However, your presentation may not have exactly five slides, but that’s no problem. You can easily customize this part of the code to suit your needs.
In the VBA Editor, adjust the slide numbers following “FirstSlide” and “LastSlide” to specify the range of slides you want to include in the shuffle. By default, the shuffling starts from slide 2 to avoid including the title slide. If you wish to exclude the title slides from shuffling, keep “FirstSlide = 2” as it is.
For instance, let’s say you have a presentation with ten slides, and you want to skip shuffling the title slide. In that case, set “FirstSlide = 2” and “LastSlide = 10”. This way only slides 2 to 10 will be included in the shuffling process, and your title slide will remain unaffected.
- Now that you have completed and customized the code for your presentation, it’s time to add action buttons to the slides. To do that, insert any shape on the first slide (or any slide you prefer), then select the shape and navigate to Insert > Action > Run Macro. Then choose the Macro you just created. This will activate the shuffling of your slides during the Slide Show Mode, providing an engaging experience for your audience.
- Save your PowerPoint file in a PPTM format (Macro-enabled presentation) to retain the Macros you created. Select File > Save As and choose PPTM from the drop-down list to ensure that the macros you’ve created will be preserved and not lost.
Now enter the Presentation Mode and click the button on the first slide to shuffle your slides randomly. Enjoy your dynamic and non-repeating presentation.
How to Shuffle Only Even or Odd Slides
In case you want to shuffle only specific slides in your presentation, like even or odd slides, you can use the following VBA code to only randomize even-numbered or odd-numbered slides without disturbing the rest.
To do that, follow the steps from above until you get to the Visual Basic Editor window and insert the following code.
Sub Shuffleslides()
EvenShuffle = True (replace with false if only odd-numbered slides are shuffled)
FirstSlide = 2 (should be an even/odd number based on needs)
LastSlide = 8
Randomize
For i = FirstSlide To LastSlide Step 2
Generate: ‘generate a random no between first slide and last slide’
RSN = Int((LastSlide – FirstSlide + 1) * Rnd) + FirstSlide
If EvenShuffle = True Then
If RSN Mod 2 = 1 Then GoTo generate
Else
If RSN Mod 2 = 0 Then GoTo generate
End If
ActivePresentation.Slides(i).MoveTo (RSN)
If i < RSN Then ActivePresentation.Slides(RSN – 1).MoveTo (i)
If i > RSN Then ActivePresentation.Slides(RSN + 1).MoveTo (i)
Next i
End Sub
How to Shuffle Your Slides in a Never-Ending Loop
The tutorial above demonstrates how to shuffle PowerPoint slides and play them in a random order without repetition. However, after one loop, the same shuffled order is maintained unless you shuffle the slides again.
To automatically go through all the slides in an endless loop during slide-show mode with a new random order for each loop, you can use the following code. Make sure to change the numbers after FirstSlide = and LastSlide = to fit the number of slides in your presentation.
Public Position, Range, AllSlides() As Integer
Sub ShuffleAndBegin()
FirstSlide = 2
LastSlide = 6
Range = (LastSlide – FirstSlide)
ReDim AllSlides(0 To Range)
For i = 0 To Range
AllSlides(i) = FirstSlide + i
Next i
Randomize
For N = 0 To Range
J = Int((Range + 1) * Rnd)
temp = AllSlides(N)
AllSlides(N) = AllSlides(J)
AllSlides(J) = temp
Next N
Position = 0
ActivePresentation.SlideShowWindow.View.GotoSlide AllSlides(Position)
End Sub
Sub Advance()
Position = Position + 1
If Position > Range Then
ShuffleAndBegin
Else
ActivePresentation.SlideShowWindow.View.GotoSlide AllSlides(Position)
End If
End Sub
Time to Start Your Presentation
Now you know how to shuffle PowerPoint slides like a pro. Experiment with these methods and create engaging presentations for educators, business professionals, or any scenario that requires a randomized slide order. Have fun with your dynamic and captivating slideshows.