# 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.

#### Softwares:

#### Features:

#### Here is how we create an Interactive PowerPoint Quiz Game:

## Step 1: Enable Developer Tab

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

## Step 2: Open Visual Basic Editor

**Windows:** Developer | Visual Basic

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

## Step 3: Insert VBA Macro Code

`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!

### 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