How to Shuffle PowerPoint Slides Randomly

❎ No animations! We are going to code the scoreboard counter in PowerPoint!

How to Make a Countdown Timer in PowerPoint without Animations

If you would like to shuffle your PowerPoint slides randomly so that you could present them such that the same slides do not repeat twice, you are at the right place.

How to randomly shuffle slides in PowerPoint
Total Time Needed: 5 minutes

Softwares:

- Microsoft PowerPoint
- Hyperlinks

Features:

- Sound Effects

Here is how we create an Interactive PowerPoint Quiz Game:

Step 1: Enable Developer Tab

If you're on Windows, enable the Devloper Tab by following the below mentioned steps:

Windows: Office 2010 and above: File | Options | Customise Ribbon | ☑ Developer

This will open the Visual Basic Editor to input our code. If your Microsoft Office version isn't mentioned above, click here. Note that VBA works only on Windows and MacOS.

Step 2: Open Visual Basic Editor

Windows: Developer | Visual Basic
MacOS: Office 2011 or 2016: Tools | Macro | Visual Basic Editor

This will open the Visual Basic Editor to input our code.

Step 3: Insert VBA Macro Code

The following VBA Code shuffles the set of slides from Slide 2 to Slide 7 in random order. Once the code is typed (or copy-pasted) in your VBA Module, you can adjust the FirstSlide and the LastSlide variables and run the code in the Visual Basic Editor Panel.
				
					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 
				
			

We can also run this code in Slide Show Mode in case you wish to use this interactive feature in your PowerPoint Games such as a Quiz Game where all the question slides have to be randomly shuffled. To do this, insert a shape in the first slide (or anywhere really), select the shape, go to Insert | Action | Run Macro | ShuffleSlides.

Now, if you click that shape in Slide Show Mode, your PowerPoint Slides will be randomly shuffled! 

Play Video

Randomize Function in VBA

RND function in Visual Basic Application generates a random number of the data type Single which is less than 1 but greater than or equal to 0. Remember to use the Randomize Function before using the RND Function. The Randomize Function makes the order of the random numbers generated random.

There are many sequences or orders to generate pseudo-random numbers via VBA which are called seeds.

For any given initial seed, the same number sequence is generated because each successive call to the Rnd function uses the previous number as a seed for the next number in the sequence.

Before calling Rnd, use the Randomize statement without an argument to initialize the random-number generator with a seed based on the system timer.

Generate Random Number in VBA

				
					Int((upperbound - lowerbound + 1) * Rnd + lowerbound) 
				
			

Here, upperbound is the highest number in the range, and lowerbound is the lowest number in the range. So, if I wanted to generate a number between 5 and 10, my code would be Int(10 – 5 + 1) * Rnd + 5.

You can assign (store) this value to an integer variable and refer it. In this case, I stored it in RSN and it represented the changing random number.

Shuffle Even Numbered Slides

				
					Sub ShuffleSlidesEVEN()
FirstSlide = 1
LastSlide = 8

Randomize

For i = FirstSlide + 1 To LastSlide Step 2 'we are adding 1 to FirstSlide to make it even'

generate: 'generate random number between FirstSlide and LastSlide'
RSN = Int((LastSlide - FirstSlide + 1) * Rnd + FirstSlide)
If RSN Mod 2 = 1 Then GoTo generate

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 
				
			

Shuffle Odd Numbered Slides

				
					Sub ShuffleSlidesODD()
FirstSlide = 1
LastSlide = 8

Randomize

For i = FirstSlide To LastSlide Step 2 'just make sure FirstSlide is Odd, incase FirstSlide = 2 then we would need to subtract 1 from it.''

generate: 'generate random number between FirstSlide and LastSlide'
RSN = Int((LastSlide - FirstSlide + 1) * Rnd + FirstSlide)
If RSN Mod 2 = 0 Then GoTo generate 

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 
				
			

Reverse PowerPoint Slides

This VBA Macro Code will reverse the order of slides:

				
					Sub ReverseSlideOrder()
For i = 1 To 5 '2 to 5 is the slide range
ActivePresentation.Slides(5).MoveTo (i)
Next i

End Sub 
				
			

🎯 In this tutorial