Consulting

Results 1 to 3 of 3

Thread: Change Format color cell text under VBA

  1. #1
    VBAX Newbie
    Joined
    Mar 2008
    Posts
    2
    Location

    Change Format color cell text under VBA

    I like to write VBA to read Format cell text, and change cont color for part of text.
    example:
    now is the time for all good men to come to the aid of their party
    Change to
    now is the time for all good men to come to the aid of their party

    now is the time for all good men to come to the aid of their party
    Last edited by ab21cn; 03-13-2008 at 02:42 AM. Reason: title easy understand

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Public Sub Test()
    Dim i As Long

    With ActiveCell

    For i = 1 To Len(.Value)

    If .Characters(i, 1).Font.ColorIndex = 3 Then

    .Characters(i, 1).Font.ColorIndex = 5
    End If
    Next i
    End With

    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Newbie
    Joined
    Mar 2008
    Posts
    2
    Location
    Workable... Thank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •