I'm still learning VBA, so any help here would be appreciated. I have two Worksheet Changes below that I understand will only work if combined. They have different ranges with different colours. Basically, it's do one or the other depending on the cell selection. Can anyone assist to join these two?
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim rng As Range
Cancel = True
Set rng = ActiveSheet.Range("f9:f18")
Worksheets("Management").Unprotect
If Intersect(Target, rng) Is Nothing Then Exit Sub
Select Case True
Case Target.Interior.Color = RGB(255, 255, 255): Target.Interior.Color = RGB(255, 199, 206)
Case Target.Interior.Color = RGB(255, 199, 206): Target.Interior.Color = RGB(255, 255, 255)
End Select
Worksheets("Management").Protect
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim rng As Range
Cancel = True
Set rng = ActiveSheet.Range("g9:k18")
Worksheets("Management").Unprotect
If Intersect(Target, rng) Is Nothing Then Exit Sub
Select Case True
Case Target.Interior.Color = RGB(255, 255, 255): Target.Interior.Color = RGB(198, 239, 206)
Case Target.Interior.Color = RGB(198, 239, 206): Target.Interior.Color = RGB(255, 255, 255)
End Select
Worksheets("Management").Protect
End Sub