How to format the first character of a string in an Excel 2010 cell

I would like to change the font color of the first character in a string within a cell.  Can this be done?
tballinAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Martin LissConnect With a Mentor Older than dirtCommented:
Sorry but if it's a number (even formatted as text) I don't think it can be done.
0
 
als315Commented:
You should have no problems if you will do it manually. How do you like to accomplish this?
0
 
tballinAuthor Commented:
I would like to setup a formatting rule - there's just too many cells to do this manually.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
als315Commented:
You can't do it with formatting rule, because in these rules you can change colors only in whole cell, but you can do it with macro. Is it acceptable?
0
 
tballinAuthor Commented:
A macro will work.
0
 
Martin LissOlder than dirtCommented:
Sub HighLightCell()

    Range("A1").Characters(1, 1).Font.Color = vbRed

End Sub
0
 
Martin LissOlder than dirtCommented:
Or
Sub HighLightCell()

    Range("A1").Characters(1, 1).Font.Bold = True 'etc.

End Sub
0
 
tballinAuthor Commented:
When I run this, the entire cell takes on the new format, not just the first character.
0
 
Martin LissOlder than dirtCommented:
Did you copy it correctly? This is what I see.
?
0
 
Martin LissOlder than dirtCommented:
Or the following where I did Range("A1").Characters(1, 1).Font.Size = 24.
??
0
 
tballinAuthor Commented:
I might be copying it wrong... but here's what I'm seeing:

code.JPGsheet.JPG
0
 
Martin LissOlder than dirtCommented:
Hmmm. It seems that it does that for numbers. Let me see what I can do.
0
 
Martin LissOlder than dirtCommented:
This does it
Sub HighLightCell()

    Range("A2").Value = "'" & Range("A2").Value
    Range("A2").Characters(1, 1).Font.Color = vbRed
    Range("A2").HorizontalAlignment = xlRight
    
End Sub

Open in new window

0
All Courses

From novice to tech pro — start learning today.