Sub GridInRectangle()

    Dim oSh As Shape
    Dim oSld As Slide
    Dim sngwidth As Single  ' width/height of a grid rect
    Dim sngheight As Single
    Dim lCols As Long
    Dim lRows As Long
    Dim x As Long   ' which col across are we making
    Dim y As Long   ' which row down are we making
    Dim sngLeft As Single   ' where to draw current rectangle
    Dim sngTop As Single
    Dim sTemp As String

    If Not ActiveWindow.Selection.Type = ppSelectionShapes Then
        MsgBox "Select something, then try again"
        Exit Sub
    End If

    ' get rows/cols from user
    sTemp = InputBox("How many columns?", "Columns")
        If CLng(sTemp) > 0 Then
            lCols = CLng(sTemp)
            sTemp = InputBox("How many rows?", "Rows")
            If CLng(sTemp) > 0 Then
                lRows = CLng(sTemp)
                Exit Sub
            End If
            Exit Sub
         End If

    Set oSh = ActiveWindow.Selection.ShapeRange(1)
    Set oSld = oSh.Parent

    sngwidth = oSh.width / lCols
    sngheight = oSh.height / lRows

    For x = 0 To lCols - 1
        For y = 0 To lRows - 1
          ' with osld.Shapes.AddShape(msoShapeRectangle, left, top, width, height)
            With oSld.Shapes.AddShape(msoShapeRectangle, oSh.Left + x * sngwidth, oSh.Top + y * sngheight, sngwidth, sngheight)
                Call .Tags.Add("Grid", "YES")
            End With

End Sub