Hello everyone,
I am not very familiar with VBA coding and somehow managed to create the following code to receive a popup message as soon as one of four dates gets selected more than two times. (E1-E4 are the cells in which there is a sum formula to count the dates in a column)
Now my issue is that as soon as one of the "If" conditions are met, the message of the condition met will appear for every entry after that regardless if it's a different date.
Does someone know how i have to change the code so it works?
Code:
Code
- Private Sub Worksheet_Change(ByVal Target As Range)
- Set Target = Me.Range("E1")
- If Target.Value > 2 Then
- MsgBox "MI 14.10.2020 / 0900-1000 bereits ausgebucht! Bitte wählen Sie ein anderes Datum!"
- End If
- Set Target = Me.Range("E2")
- If Target.Value > 2 Then
- MsgBox "FR 16.10.2020 / 1100-1200 bereits ausgebucht! Bitte wählen Sie ein anderes Datum!"
- End If
- Set Target = Me.Range("E3")
- If Target.Value > 2 Then
- MsgBox "DI 20.10.2020 / 1600-1700 bereits ausgebucht! Bitte wählen Sie ein anderes Datum!"
- End If
- Set Target = Me.Range("E4")
- If Target.Value > 2 Then
- MsgBox "DO 22.10.2020 / 1330-1430 bereits ausgebucht! Bitte wählen Sie ein anderes Datum!"
- End If
- End Sub
Thanks a lot for any help!!