ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How toChange color of first letter inEach word ofA column at once (https://www.excelbanter.com/excel-discussion-misc-queries/255586-how-tochange-color-first-letter-ineach-word-ofa-column-once.html)

LSSK

How toChange color of first letter inEach word ofA column at once
 
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?

Dave Peterson

How toChange color of first letter inEach word ofA column at once
 
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 he
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.)



LSSK wrote:

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?


--

Dave Peterson


All times are GMT +1. The time now is 12:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com