How toChange color of first letter inEach word ofA column at once

L

LSSK

Just imagine cell A1 "all". Now imagine cell A2 containing "ball" and then
cell A3 containing "call" and so on for many more words in this A column.
How can I change the color of just the first letter of every word in this
column?
 
D

Dave Peterson

As long as the cell contains text (not a formula and not a number), you can
highlight the first letter of each cell in the formulabar and use Format|Cells
(xl2003 menus) to change the font color.

You could use a macro to do the work, too:

Option Explicit
Sub testme()

Dim myCell As Range
Dim myRng As Range
Dim wks As Worksheet

Set wks = Worksheets("Sheet1")

With wks
Set myRng = Nothing
On Error Resume Next
Set myRng = .Range("A1", .Cells(.Rows.Count, "A").End(xlUp)) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
On Error GoTo 0
End With

If myRng Is Nothing Then
MsgBox "No text constants in the range!"
Exit Sub
End If

For Each myCell In myRng.Cells
With myCell.Characters(Start:=1, Length:=1).Font
' .Name = "Arial"
' .FontStyle = "Regular"
' .Size = 10
' .Strikethrough = False
' .Superscript = False
' .Subscript = False
' .OutlineFont = False
' .Shadow = False
' .Underline = xlUnderlineStyleNone
.ColorIndex = 3 'red on my pc
End With
Next myCell
End Sub

I commented out the lines that changed the format for that character. I thought
you may want to change them, too.

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top