ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Watch not working for action on other cells (https://www.excelbanter.com/excel-programming/415548-watch-not-working-action-other-cells.html)

S Himmelrich

Watch not working for action on other cells
 
This code was working at one point, but now it's not:

If Target.Address = "$B$6" Then
Application.EnableEvents = False
Select Case Target.Value
Case "Project-Cost Sizing"
Range("B16:C19").Interior.ColorIndex = 1
Range("B21:C21").Interior.ColorIndex = 1
Range("B33:C33").Interior.ColorIndex = 1


Case "Project-Cost & Go"
Range("B16:C17").Interior.ColorIndex = 1
Range("B18:C19").Interior.ColorIndex = 1
Range("B20:C20").Interior.ColorIndex = 1
Range("B21:C21").Interior.ColorIndex = 1
Range("B33:C33").Interior.ColorIndex = 1


Case "Consulting-M&A"
Range("B16:C17").Interior.ColorIndex = 1
Range("B18:C19").Interior.ColorIndex = 1
Range("B20:C20").Interior.ColorIndex = 1
Range("B21:C21").Interior.ColorIndex = 1
Range("B33:C33").Interior.ColorIndex = 1


Case "Consulting-DEFINE"
Range("B16:C19").Interior.ColorIndex = 0
Range("B33:C33").Interior.ColorIndex = 0


Case "[select from list]"
Range("B16:C19").Interior.ColorIndex = 1
Range("B21:C21").Interior.ColorIndex = 1
Range("B33:C33").Interior.ColorIndex = 1


End Select
End If



joel

Watch not working for action on other cells
 
I s this code in a work_sheet change function? I think the events wre turned
off. Run this code to fix the problem.


sub turnOnEvents()

Application.EnableEvents = True

end sub

"S Himmelrich" wrote:

This code was working at one point, but now it's not:

If Target.Address = "$B$6" Then
Application.EnableEvents = False
Select Case Target.Value
Case "Project-Cost Sizing"
Range("B16:C19").Interior.ColorIndex = 1
Range("B21:C21").Interior.ColorIndex = 1
Range("B33:C33").Interior.ColorIndex = 1


Case "Project-Cost & Go"
Range("B16:C17").Interior.ColorIndex = 1
Range("B18:C19").Interior.ColorIndex = 1
Range("B20:C20").Interior.ColorIndex = 1
Range("B21:C21").Interior.ColorIndex = 1
Range("B33:C33").Interior.ColorIndex = 1


Case "Consulting-M&A"
Range("B16:C17").Interior.ColorIndex = 1
Range("B18:C19").Interior.ColorIndex = 1
Range("B20:C20").Interior.ColorIndex = 1
Range("B21:C21").Interior.ColorIndex = 1
Range("B33:C33").Interior.ColorIndex = 1


Case "Consulting-DEFINE"
Range("B16:C19").Interior.ColorIndex = 0
Range("B33:C33").Interior.ColorIndex = 0


Case "[select from list]"
Range("B16:C19").Interior.ColorIndex = 1
Range("B21:C21").Interior.ColorIndex = 1
Range("B33:C33").Interior.ColorIndex = 1


End Select
End If





All times are GMT +1. The time now is 11:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com