MrSmith484
New Member
- Joined
- Jul 9, 2018
- Messages
- 4
Dear VBA Experts,
Excel newbie here
I could really use some help with thi piece of code I´can´t get to function.
I want the colour of row "x" in column "K" to change given a certain value of ro "x" in column "G" AND a maximum value in row "x" in columns H-J. Here is what i have come up with as a start Thus far, but doesnt work.
Private Sub Worksheet_Change(ByVal Target As Range)
'On Error Resume Next
If Target.Column = 7 And Target.Value = 5 Then
Target.Offset(0, "K").Interior.ColorIndex = 4
ElseIf Target.Columns = "7-9" And Target.Value = 4 Then
Target.Offset(0, 4).Interior.ColorIndex = 2
Else: Target.Offset(0, "K").Interior.ColorIndex = 48
An example:
"G27" has the value "5" and the max value of "H27-I27" is also 5 then "K27" turns red
If "G27" has the value "5" and the max value of "H27-I27" is 2 then "K27" turns green
Else "K27" turns grey.
I know it is possible to solve the problem w conditional formating, but I need to code this in VBA help is much aprreciated!
Excel newbie here
I could really use some help with thi piece of code I´can´t get to function.
I want the colour of row "x" in column "K" to change given a certain value of ro "x" in column "G" AND a maximum value in row "x" in columns H-J. Here is what i have come up with as a start Thus far, but doesnt work.
Private Sub Worksheet_Change(ByVal Target As Range)
'On Error Resume Next
If Target.Column = 7 And Target.Value = 5 Then
Target.Offset(0, "K").Interior.ColorIndex = 4
ElseIf Target.Columns = "7-9" And Target.Value = 4 Then
Target.Offset(0, 4).Interior.ColorIndex = 2
Else: Target.Offset(0, "K").Interior.ColorIndex = 48
An example:
"G27" has the value "5" and the max value of "H27-I27" is also 5 then "K27" turns red
If "G27" has the value "5" and the max value of "H27-I27" is 2 then "K27" turns green
Else "K27" turns grey.
I know it is possible to solve the problem w conditional formating, but I need to code this in VBA help is much aprreciated!