View Single Post
 
Old 04-28-2019, 10:49 AM
derridascat derridascat is offline Windows 10 Office 2016
Novice
 
Join Date: Apr 2019
Posts: 3
derridascat is on a distinguished road
Default VBA - Changing color of text in a single column of a table

Hey all,

I'm looking to write a VBA macro that searches the first column of all my tables in powerpoint, and switches a specific text to a different color. I.E. I'd like all my tables that have "Yes" in the first column to switch the text "Yes" to a different color then black font, as doing it manually is going to take a bit of time. Here's what I got so far, but I can't get figure out how to specify the first column only. Appreciate the help!


Option Explicit

Sub ChangeTextColors()

Dim oSl As Slide
Dim oSh As Shape
Dim lCol As Long
Dim lRow As Long
Dim x As Long


For Each oSl In ActivePresentation.Slides
For Each oSh In oSl.Shapes

If oSh.HasTable Then
With oSh.Table
For lCol = 1 To .Columns.Count
For lRow = 1 To .Rows.Count
With .Cell(lRow, lCol).Shape
If .HasTextFrame Then
If .TextFrame.HasText Then
If .TextFrame.TextRange = "YES" Then
.TextFrame.TextRange.Font.Color.RGB = RGB(255, 0, 0)
End If
End If
End If
End With
Next
Next
End With
End If

Next
Next

End Sub
Reply With Quote