Option Explicit
Sub DeleteHighlightedColumnsFromAllTables()
Dim highlightColor As Long
highlightColor = RGB(255, 255, 0) 'yellow
Dim currentShape As Shape
Dim slideIndex As Long
For slideIndex = 1 To 55
Select Case slideIndex
Case 1 To 33, 44 To 55
For Each currentShape In ActivePresentation.Slides(slideIndex).Shapes.Placeholders
If currentShape.HasTable Then
If Not DeleteHighlightedColumnsFromTable(currentShape.Table, highlightColor) Then Exit Sub
End If
Next currentShape
End Select
Next slideIndex
MsgBox "Completed!", vbExclamation
End Sub
Private Function DeleteHighlightedColumnsFromTable(ByVal targetTable As Table, ByVal highlightColor As Long) As Boolean
Dim lastRow As Long
Dim lastColumn As Long
Dim columnIndex As Long
Dim response As VbMsgBoxResult
Dim slideNameAndColumnHeader As String
With targetTable
lastRow = .Rows.Count
lastColumn = .Columns.Count
For columnIndex = lastColumn To 1 Step -1
If .Cell(lastRow, columnIndex).Shape.Fill.ForeColor.RGB = highlightColor Then
.Parent.Parent.Select 'go to slide (optional)
slideNameAndColumnHeader = .Parent.Parent.Name & " - " & .Cell(1, columnIndex).Shape.TextFrame2.TextRange.Text
response = MsgBox("Are you sure you want to delete this column?", vbQuestion + vbYesNoCancel, slideNameAndColumnHeader)
If response = vbCancel Then
DeleteHighlightedColumnsFromTable = False
Exit Function
End If
If response = vbYes Then
.Columns(columnIndex).Delete
End If
End If
Next columnIndex
End With
DeleteHighlightedColumnsFromTable = True
End Function