Try the attachment - barebones and needs some prettying-up
Option Explicit
Dim arySlides() As Long, cntSlides As Long
Dim aryRandom() As Double
Dim oPres As Presentation
Sub PickSlide(oShapeIn As Shape)
Call SetupRandomVisibleSlides
Select Case oShapeIn.Name
Case "Class 1"
Call GotoSlide(1)
Case "Class 2"
Call GotoSlide(2)
End Select
End Sub
Private Sub GotoSlide(ClassNum As Double)
Dim i As Long
For i = LBound(aryRandom) To UBound(aryRandom)
If aryRandom(i) = ClassNum Then
SlideShowWindows(1).View.GotoSlide arySlides(i + 1)
Exit Sub
End If
Next i
End Sub
Private Sub SetupRandomVisibleSlides()
Dim oSlide As Slide, oShape As Shape
Dim i As Long, j As Long
Dim HoldRnd As Double, HoldSlide As Long
Dim cntGroup As Double
Randomize
Set oPres = ActivePresentation
cntSlides = 0
cntGroup = 0#
For Each oSlide In oPres.Slides
For Each oShape In oSlide.Shapes
If oShape.Type = msoPlaceholder Then
If oShape.PlaceholderFormat.Type = ppPlaceholderTitle Then
If oShape.TextFrame.HasText Then
If LCase(oShape.TextFrame.TextRange.Text) Like "class*" Then
cntGroup = cntGroup + 1
cntSlides = cntSlides + 1
ReDim Preserve arySlides(1 To cntSlides)
arySlides(cntSlides) = oSlide.SlideNumber
ReDim Preserve aryRandom(1 To cntSlides)
aryRandom(cntSlides) = cntGroup
GoTo NextSlide
End If
End If
End If
End If
Next oShape
If cntGroup = 0 Then GoTo NextSlide
If Not oSlide.SlideShowTransition.Hidden Then
cntSlides = cntSlides + 1
ReDim Preserve arySlides(1 To cntSlides)
arySlides(cntSlides) = oSlide.SlideNumber
ReDim Preserve aryRandom(1 To cntSlides)
aryRandom(cntSlides) = cntGroup + Rnd
End If
NextSlide:
Next oSlide
For i = LBound(arySlides) To UBound(arySlides) - 1
For j = i + 1 To UBound(arySlides)
If aryRandom(i) > aryRandom(j) Then
HoldRnd = aryRandom(i)
aryRandom(i) = aryRandom(j)
aryRandom(j) = HoldRnd
HoldSlide = arySlides(i)
arySlides(i) = arySlides(j)
arySlides(j) = HoldSlide
End If
Next j
Next i
End Sub