Text Color Change

  • Thread starter Kim via OfficeKB.com
  • Start date
K

Kim via OfficeKB.com

Hi,

The change event macro below is not working. Is there a mistake in the
formula that I've missed?

Thanks!


____________________________________________________

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim vLetter As String
Dim vColor As Integer
Dim cRange As Range
Dim cell As Range

Set cRange = Intersect(Range("B3:X28"), Range(Target(1).Address))
If cRange Is Nothing Then Exit Sub

For Each cell In Target
vLetter = UCase(Left(cell.Value & " ", 1))
vColor = 0
Select Case vLetter
Case "V"
vColor = 3
Case "S"
vColor = 3
Case "E"
vColor = 3
Case "P"
vColor = 3
Case "T"
vColor = 3

End Select
Application.EnableEvents = False
cell.Text.ColorIndex = vColor
Application.EnableEvents = True
Application.Calculate
Next cell
End Sub
 
J

JulieD

Hi Kim

it seems to work when you change
cell.Text.ColorIndex = vColor
to
cell.Font.ColorIndex = vColor

Cheers
julieD
 

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