abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,431
- Office Version
- 2019
- 2010
- Platform
- Windows
hello
i have data in sheet1 and ih ave two function one to sum colored cells and the other count colored cells and i have code in event worksheets change it color the cells based on conditions all of them works but the problem when change color from a2:e it doesn't change automatically when sum and count colored in column h, i i have to press any cell and move another cell then happens changes , i would directly change color cell it changes the values in column h,i
this is my code in worksheets change event
i have data in sheet1 and ih ave two function one to sum colored cells and the other count colored cells and i have code in event worksheets change it color the cells based on conditions all of them works but the problem when change color from a2:e it doesn't change automatically when sum and count colored in column h, i i have to press any cell and move another cell then happens changes , i would directly change color cell it changes the values in column h,i
this is my code in worksheets change event
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub 'check for range
If Target.Value = "10" Then 'check if yes
Target.Offset(0, 1).Interior.ColorIndex = 6
ElseIf Target.Value = "15" Then 'check if no
Target.Offset(0, 1).Interior.ColorIndex = 3
Target.Offset(0, 2).Interior.ColorIndex = 5
Else
Target.Offset(0, 1).Interior.ColorIndex = xlNone
End If
End Sub