Answers for "vba recursive"

VBA
0

vba recursive

' Recursive
' Occurences of pWord inside pRange's text become bold and red. Case insentive.
Sub WordToBold(ByRef pRange As Range, ByVal pWord As String, _
    ByRef pPos As Integer)
    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
Posted by: Guest on February-05-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language