How do you change the value of a cell in excel by clicking on it using VBA? [closed]

This would work:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Value = "In service" Then
        Target = "Out of service"
    ElseIf Target.Value = "Out of service" Then
        Target = "In service"
    End If
End Sub

Leave a Comment