How to Make the Next Slide Random in PowerPoint

Techwalla may earn compensation through affiliate links in this story.

Microsoft PowerPoint makes it simple to build everything from professional presentations to multimedia kiosk exhibits. However, even with all of the built-in features, PowerPoint does not have a random slide command. You must use Visual Basic to make the next slide random in PowerPoint. The simplest method is to create an action button that will run a macro that calls for a random slide. Likely applications for this type of macro include games and picture slideshows.

Advertisement

Do the Initial Setup

Step 1

Launch Microsoft PowerPoint from the "Start" menu.

Video of the Day

Step 2

Open the slideshow you want to use with the random slide macro.

Step 3

Click on the Office symbol to open the menu.

Step 4

Click "PowerPoint Options" and navigate to the "Trust Center."

Advertisement

Step 5

Click the "Trust Center Settings" button, and click the radio button to "Disable all macros with notification." Click "OK" to return to the PowerPoint Options window.

Step 6

Click "Popular" and verify that "Show Developer Tab in the Ribbon" is enabled. Click "OK" to return to the presentation.

Create the Visual Basic Macro

Step 1

Press "Alt" + "F11" to open the Visual Basic Editor.

Advertisement

Step 2

Click "Insert" and choose "Module."

Step 3

Copy and paste the code below into the editor window.

Sub sort_rand() ActivePresentation.SlideShowWindow .View.GotoSlide Int(Rnd * ActivePresentation.Slides.Count) + 1 End Sub

Step 4

Press "Alt" + "Q" to save the macro and return to the presentation.

Advertisement

Create the Action Button

Step 1

Click the "Insert" tab and then the "Shapes" button.

Step 2

Click on the desired shape under the "Action Buttons" heading at the bottom of the drop-down menu.

Step 3

Click on the work area, and drag the shape to the desired size.

Step 4

Click the radio button beside "Run macro" in the dialog box that appears, and select the "sort_rand" macro you created earlier. Click "OK."

Advertisement

Step 5

Press "Ctrl" + "C" with the button selected to copy it to the clipboard.

Step 6

Click on the next slide in the left pane.

Step 7

Press "Ctrl" + "V" to paste the button into the slide. Repeat this for each slide in the presentation.

Step 8

Press "F5" to begin the slideshow from the first slide.

Advertisement

Step 9

Click on the button you created to make the next slide a random slide. Every time you click on the button, the PowerPoint macro will select a random slide to display.

Tip

You can turn any object into a button by selecting it and clicking "Action" under the "Insert" tab.

Advertisement

references