Consulting

Results 1 to 3 of 3

Thread: append color text (VBA)

  1. #1
    VBAX Newbie
    Joined
    Nov 2009
    Posts
    2
    Location

    append color text (VBA)

    I have a column of people's names in a black font. Based on a condition (which I can code in VBA), I want to append, say, a RED Asterisk to the end of the people's names? Anyone know how to do this in VBA?

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Something like
    [VBA]
    Sub Macro1()
    For Each cel In Selection
    If Left(cel, 1) = "a" Then
    cel.Value = cel.Value & "*"
    cel.Characters(Start:=Len(cel), Length:=1).Font.Color = vbRed
    End If
    Next
    End Sub

    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Newbie
    Joined
    Nov 2009
    Posts
    2
    Location
    That did it! Thank you very much!!

Posting Permissions

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