S
saud
Thanks again. I really appreciate how helpful you people are.
I was looking for a way to be able to color the whole sheet unti
thanks to David McRitchie directed me to a reply to a question o
Possible to Apply More than Three Conditional Formats to a column?
There was a color-code
So I did as directed, Right click on the Excel sheet tab and selec
'View Code'
I copied the following into the sheet that just opened in the
VBA editor.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count <> 1 Then Exit Sub 'action only if 1
cell is selected
If Target.Column <> 1 Then Exit Sub 'action only if
cell changed in column A
Select Case Target.Value 'evaluate the number that
you just entered
Case Is = 1
Target.EntireRow.Interior.ColorIndex = 3 'red
Case Is = 2
Target.EntireRow.Interior.ColorIndex = 38 'pink
Case Is = 3
Target.EntireRow.Interior.ColorIndex = 4 'green
Case Is = 4
Target.EntireRow.Interior.ColorIndex = 6 'yellow
Case Is = 5
Target.EntireRow.Interior.ColorIndex = 8 'majenta
Case Is = 6
Target.EntireRow.Interior.ColorIndex = 5 'blue
Case Else 'none of the above numbers
Exit Sub
End Select
End Sub
but unfortunately when I enter the number 1 in column A I get a massag
in the VBA editor saying (compile error – syntax error ) and when
press OK on the system widow it shades the first line which say
*Private Sub Worksheet_Change(ByVal Target As Range* with yello
color and this line *cell is selected* with blue color and it didn’
change the cell color ? So please help me,
What is the solution to this?
Thanks
I was looking for a way to be able to color the whole sheet unti
thanks to David McRitchie directed me to a reply to a question o
Possible to Apply More than Three Conditional Formats to a column?
There was a color-code
So I did as directed, Right click on the Excel sheet tab and selec
'View Code'
I copied the following into the sheet that just opened in the
VBA editor.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count <> 1 Then Exit Sub 'action only if 1
cell is selected
If Target.Column <> 1 Then Exit Sub 'action only if
cell changed in column A
Select Case Target.Value 'evaluate the number that
you just entered
Case Is = 1
Target.EntireRow.Interior.ColorIndex = 3 'red
Case Is = 2
Target.EntireRow.Interior.ColorIndex = 38 'pink
Case Is = 3
Target.EntireRow.Interior.ColorIndex = 4 'green
Case Is = 4
Target.EntireRow.Interior.ColorIndex = 6 'yellow
Case Is = 5
Target.EntireRow.Interior.ColorIndex = 8 'majenta
Case Is = 6
Target.EntireRow.Interior.ColorIndex = 5 'blue
Case Else 'none of the above numbers
Exit Sub
End Select
End Sub
but unfortunately when I enter the number 1 in column A I get a massag
in the VBA editor saying (compile error – syntax error ) and when
press OK on the system widow it shades the first line which say
*Private Sub Worksheet_Change(ByVal Target As Range* with yello
color and this line *cell is selected* with blue color and it didn’
change the cell color ? So please help me,
What is the solution to this?
Thanks