trishcollins
Board Regular
- Joined
- Jan 7, 2006
- Messages
- 71
So, I used some other code I had written to find and bold words in the body of a Pivot table and automatically run whenever the Pivot table refreshes. I works fine. The range I have setup for that was the PivotBodyRange. I now have a requirement to find and bold certain words in one cell (A1) of the same worksheet. The code bolds everything. I am obviously doing something wrong. Any suggestions?
VBA Code:
Sub Find_and_Bold_Tombstone()
Dim rcell As Range, sToFind As String, iSeek As Long
Dim Text(1 To 13) As String
Dim Wksh As Worksheet
Dim i As Integer
Dim Rng As Range
Text(1) = "Project Name"
Text(2) = "Client Contact Info"
Text(3) = "DGEAS Contact Info:"
Text(4) = "Explanation:"
Text(5) = "JDCP Contact Info:"
Text(6) = "JDCP Intake Number:"
Text(7) = "CEIP-4 Contact Info:"
Text(8) = "Total Use Case"
Text(9) = "Simple Use Cases Requiring Assyst Tickets ONLY:"
Text(10) = "Complex Uses Case Requiring a BRD:"
Text(11) = "Date File Created:"
Text(12) = "Date Last Updated:"
Text(13) = "Document Version:"
Set Wksh = Worksheets("Use Case Details")
Set Rng = Wksh.Range("A1")
Rng.Font.Bold = False
Rng.Font.Underline = False
Rng.Select
For i = LBound(Text) To UBound(Text)
sToFind = Text(i)
iSeek = InStr(1, Rng.Value, sToFind)
Do While iSeek > 0
Rng.Characters(iSeek, Len(sToFind)).Font.Bold = True
iSeek = InStr(iSeek + 1, Rng.Value, sToFind)
Loop
Next i
End Sub