Learn to make a PowerPoint Quiz Game using Trigger Animations....

**How to Shuffle PowerPoint Slides in a Random Order**

If you would like to shuffle a set of slides randomly so that you could present them such that the same slides do not repeat twice, you are at the right place!

I proposed a very simple solution to solve this query that many teachers have brought forward – randomly shuffle a set of slides!

You want the slides from 2 to 7 in your PowerPoint Presentation randomly shuffled? We got your back! I have a video made explaining and demonstrating it, if you’d like to just copy the PPT VBA code and be done with, here is the code too:

```
Sub ShuffleSlides()
FirstSlide = 2
LastSlide = 7
'just change your slide numbers above'
Randomize
For i = FirstSlide To LastSlide
RSN = Int((LastSlide - FirstSlide + 1) * Rnd + FirstSlide)
ActivePresentation.Slides(i).MoveTo (RSN)
Next i
End Sub
```

Once the code is typed (or copy-pasted) in your VBA Panel, go back to your PowerPoint Presentation. We shall now make a button. If that button is clicked – the slides between 2 to 7 would have to be randomly shuffled.

So Insert a Shape in the First Slide (or anywhere really), select the shape, go to Insert > Action > Mouse Click > Run Macro > ShuffleSlides.

Now, if you click on that shape in Slide Show Mode, your PowerPoint Slides would be randomly shuffled! Good job!

If you have any questions, feel free to contact me. Do watch the video before that as it might answer most of your questions!

## RND Function & 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.

## How to generate a random number between two numbers (range)

`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 formula would be: *Int(10 – 5 + 1) * Rnd + 5.*

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

## Shuffle Only EVEN Numbered Slides in PowerPoint

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

## Reverse the order of PowerPoint Slides

```
Sub ReverseSlideOrder()
For i = 2 To 5 '2 to 5 is the slide range'
ActivePresentation.Slides(5).MoveTo (i)
Next i
'This will reverse the order of slides
the 5th slide will become the 2nd
the 4th slide will become the 3rd...''
End Sub
```

## Shuffle Only ODD Numbered Slides in PowerPoint

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

## Interactive True-or-False QUIZ GAME in PowerPoint

Learn to make a PowerPoint Quiz Game using Trigger Animations....

## How to Shuffle PowerPoint Slides in a Random Order

If you want all the slides of a particular range...

## Populate A PowerPoint Quiz From Excel With VBA

Import Questions & Answers of a Microsoft PowerPoint Multiple-Choice Quiz...