Auto text color
Thanks, so I went in and added the following to my spreadsheet.
Notice on set rng L17:L3333.....I don't know what I am doing there. I did
add my data though, example 0,1,&2 for the color change.
You can choose the data validate beginning on cell L19 through about L3444,
and I add to it daily. What code should I use for that?
Also, when I selected L19 and changed it to 0, two rows down is where the
color change took place based on what you see below as code. I need the
first row to change color on row 19.
What does the i mean? Do I need to substitute anything for the i?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
i = Target.Row
Set rng = Range("L17:L3333").CurrentRegion
For i = 1 To rng.Rows.Count
Select Case Cells(i, 12)
Case "0"
rng.Rows(i).Font.ColorIndex = 44
Case "1"
rng.Rows(i).Font.ColorIndex = 42
Case "2"
rng.Rows(i).Font.ColorIndex = 3
End Select
Next i
End Sub
"Dan Oakes" wrote:
If your data validation starts in column L then you'll need to change
Select Case Cells(i, 1) to Select Case Cells(i, 12). And yes, for this
code to work you'll have to go to the Visual Basic Editor and paste it
in the sheet you want to use it with, not in a module. And obviously
you'll also need to change "a", "b" and "c" to whatever your data is.
-- Dan
|