Good Afternoon
I'm formatting these large spreadsheets that contain mostly text. I'm trying to find characters used as bullets (Chr(149)) to format them.
The code below gives me a run-time error 438 on this line: If .Characters(i, 1) = SearchValue Then
I have tested the code by changing it to search for characters formatted in a specific colour and that works so the problem must be with trying to find the character. I can't find more specific examples how to find a character buy ASCII code but VBA doesn't like below.
Any pointers would be much appreciated.
Thanks,
Christine
I'm formatting these large spreadsheets that contain mostly text. I'm trying to find characters used as bullets (Chr(149)) to format them.
The code below gives me a run-time error 438 on this line: If .Characters(i, 1) = SearchValue Then
I have tested the code by changing it to search for characters formatted in a specific colour and that works so the problem must be with trying to find the character. I can't find more specific examples how to find a character buy ASCII code but VBA doesn't like below.
Any pointers would be much appreciated.
VBA Code:
Public Sub ColourBullet()
Dim rng As Range, cell As Range
Set rng = ActiveSheet.Range("C10:Q200")
Set cell = ActiveCell
Dim SearchValue As String
SearchValue = Chr(149)
Dim i As Long
Dim StartChar As Long
For Each cell In rng
With cell
For i = 1 To Len(.Value)
If .Characters(i, 1) = SearchValue Then
.Characters(i, 1).Font.Color = RGB(236, 102, 2)
End If
Next i
End With
Next cell
MsgBox ("Task Completed")
Cells(1, 1).Select
End Sub
Thanks,
Christine