How to Randomize Slides in PowerPoint Presentation

Manually as well as using code

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.

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.

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

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 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 andcreate engaging presentationsfor educators, business professionals, or any scenario that requires a randomized slide order. Have fun with your dynamic and captivating slideshows.

Anya is a freelance technology writer. Originally from Russia, she is currently a full-time Remote Worker and Digital Nomad. With a background in Journalism, Language Studies, and Technical Translation, Anya couldn’t imagine her life and work without using modern technology on a daily basis. Always looking out for new ways to make her life and location-independent lifestyle easier, she hopes to share her experiences as a tech- and internet-addict through her writing.Read Anya’s Full Bio

Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.

HomeAbout UsEditorial StandardsContact UsTerms of Use

Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved