Hi there. I got an Excel worksheet containing a column of hourly wage. I also got the following script to detect the wage level so that user will be alert to those lower wages.
Private Sub Worksheet_Change(ByVal Target As Range)
For k = 2 To 31
If Sheet32.Cells(k, 42).Value < 29 Then # where 29 is minimum wage
Sheet32.Cells(k, 42).Font.ColorIndex = 3 # wage will be change to Red
ElseIf Sheet32.Cells(k, 42).Value >= 29 Then
Sheet32.Cells(k, 42).Font.ColorIndex = 10 # where wage will remain green
End If
Next
End Sub
However, whenever there is change in the wage, it prompts me with a error message saying there is something wrong with the property of the Font colour index. Did I miss something?
Thanks.
Private Sub Worksheet_Change(ByVal Target As Range)
For k = 2 To 31
If Sheet32.Cells(k, 42).Value < 29 Then # where 29 is minimum wage
Sheet32.Cells(k, 42).Font.ColorIndex = 3 # wage will be change to Red
ElseIf Sheet32.Cells(k, 42).Value >= 29 Then
Sheet32.Cells(k, 42).Font.ColorIndex = 10 # where wage will remain green
End If
Next
End Sub
However, whenever there is change in the wage, it prompts me with a error message saying there is something wrong with the property of the Font colour index. Did I miss something?
Thanks.