Hi to all.
Please help me change/improve this code that will colorize not only the symbol "!", but also the name before symbol "!" till comma that comes before the name ? (see pic)
Maybe it will help - before each name has Space, also if the name is the first word in line, same if name comes after symbol of House.
Some names has also a letter in the brackets like (ת) or (ל), it's also should be colorized.
The range of searching is E5:E35.
This is a code:
=====================
Sub paintText()
Set myRange = Range("E5:E35") 'The Range that contains the substring you want to change color
substr = "!" 'The text you want to change color
txtColor = 3 'The ColorIndex which repsents the color you want to change
For Each myString In myRange
lenstr = Len(myString)
lensubstr = Len(substr)
For i = 1 To lenstr
tempString = Mid(myString, i, lensubstr)
If tempString = substr Then
myString.Characters(Start:=i, Length:=lensubstr).Font.ColorIndex = txtColor
End If
Next i
Next myString
End Sub
=====================
Thanks
Please help me change/improve this code that will colorize not only the symbol "!", but also the name before symbol "!" till comma that comes before the name ? (see pic)
Maybe it will help - before each name has Space, also if the name is the first word in line, same if name comes after symbol of House.
Some names has also a letter in the brackets like (ת) or (ל), it's also should be colorized.
The range of searching is E5:E35.
This is a code:
=====================
Sub paintText()
Set myRange = Range("E5:E35") 'The Range that contains the substring you want to change color
substr = "!" 'The text you want to change color
txtColor = 3 'The ColorIndex which repsents the color you want to change
For Each myString In myRange
lenstr = Len(myString)
lensubstr = Len(substr)
For i = 1 To lenstr
tempString = Mid(myString, i, lensubstr)
If tempString = substr Then
myString.Characters(Start:=i, Length:=lensubstr).Font.ColorIndex = txtColor
End If
Next i
Next myString
End Sub
=====================
Thanks