vba set font color white
Range("a1").Font.Color = vbRed
vba set font color white
Range("a1").Font.Color = vbRed
excel vba color text in cell
' Occurences of pWord inside pRange's text become bold and red.
' Case insensitive.
Sub WordToBold(ByRef pRange As Range, ByVal pWord As String, _
Optional ByVal pPos As Integer = 1)
Dim pos As Integer
pos = InStr(pPos, pRange.Value, pWord, vbTextCompare)
If pos > 0 Then
With pRange.Characters(pos, Len(pWord))
.Font.Bold = True
.Font.Color = vbRed
End With
WordToBold pRange, pWord, pos + 1
End If
End Sub
'--------------------------------------------------------------------------------
Sub TestIt()
Range("A1") = "Run, Forrest run"
WordToBold Range("A1"), "run"
End Sub
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us