Conditional formatting of PowerPoint-table

Related to this question, I wonder if there is any way to apply conditional formatting to a table in PowerPoint, without importing an Excel-table. E.g. to change the background colour of a cell in the table depending on the value in it.

1 Answer

Yes, but only via code/macro of some sort. You'd iterate through the .Cell collection of the table, check to see that each cell has text and if so, if the value of the text converted to numeric is < 0, then set the cell's .Shape fill to whatever you like. Pass a reference to the table to this, for example:

Sub FormatTheTable(oTbl As Table) Dim x As Long Dim y As Long With oTbl For x = 1 To .Rows.Count For y = 1 To .Columns.Count If .Cell(x, y).Shape.TextFrame.HasText Then If CDbl(.Cell(x, y).Shape.TextFrame.TextRange.Text) < 0 Then .Cell(x, y).Shape.Fill.ForeColor.RGB = RGB(255, 0, 0) End If End If Next ' Column Next ' Row End With ' otbl
End Sub
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like