Header
PowerPoint tips, hints and tutorials that will change your presentations for ever!

INDEX

 

Jigsaws
Sounds
Video
Custom Shows
vba code
NaviSlides
Games for teachers
Bullets
Triggers
Security
Flash Cards
Multiple Instances
PowerPoint 2007
Mail Merge
Random events
Animation
Hyperlinks
Set spellcheck language


Home buttonTutorial buttonContact buttonProducts button

VBA - Bold targeted row in a table

This is basic vba code to find tables in a presentation, search for a target word and bold the whole row and make the text red.

You can adapt it fairly easily to make other changes. Make sure you include BOTH sub routines.

Sub Find_Change()
Dim otbl As Table
Dim R As Long
Dim C As Long
Dim osld As Slide
Dim oshp As Shape
Const target_Word As String = "Yes" 'change this to suit
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.HasTable Then
Set otbl = oshp.Table
'loop through cells
For R = 1 To otbl.Rows.Count
For C = 1 To otbl.Columns.Count
If InStr(UCase(otbl.Cell(R, C).Shape.TextFrame2.TextRange.Text), UCase(target_Word)) > 0 Then Call boldrow(R, otbl)
Next C
Next R
End If
Next oshp
Next osld
End Sub


Sub boldrow(lngR As Long, otbl As Table)
Dim C As Long
For C = 1 To otbl.Columns.Count
With otbl.Cell(lngR, C).Shape.TextFrame2.TextRange.Font
'Bold it
.Bold = True
'Make Red
.Fill.ForeColor.RGB = RGB(255, 0, 0)
End With
Next
End Sub

 

 

Back to the Index Page

POWERPOINT BLOG

Articles on your favourite sport

Free Microsoft PowerPoint Advice, help and tutorials, Template Links
This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and Wales No.5780175
PowerPoint® is a registered trademark of the Microsoft Corporation