The code below uses the value in cells G2:G6 (worksheet name "Data"), whenever they are updated, to populate the data validation input message in worksheet "Overview" cells F4:F8
And the value in cells I2:I6 (worksheet name "Data"), to populate the data validation input message in worksheet "Overview" cells G4:G8
However, I would like to change the code so that it's triggered only when the user leaves the “Data” worksheet, by converting the code to a Worksheet Deactivate event.
Would appreciate anybody's help. Thank you.
"Data" Worksheet
"Overview" Worksheet
And the value in cells I2:I6 (worksheet name "Data"), to populate the data validation input message in worksheet "Overview" cells G4:G8
However, I would like to change the code so that it's triggered only when the user leaves the “Data” worksheet, by converting the code to a Worksheet Deactivate event.
Would appreciate anybody's help. Thank you.
"Data" Worksheet
"Overview" Worksheet
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge = 1 And Not Intersect(Target, Range("G2:G6")) Is Nothing Then
With Worksheets("Overview").Range("F" & Target.Row + 2).Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator:=xlBetween
.InputTitle = "Comment"
.InputMessage = Target.Value
End With
ElseIf Target.CountLarge = 1 And Not Intersect(Target, Range("I2:I6")) Is Nothing Then
With Worksheets("Overview").Range("G" & Target.Row + 2).Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator:=xlBetween
.InputTitle = "Original Target Date"
.InputMessage = Target.Value
End With
End If
End Sub