Diese Anweisung kannst du in ein Ereignismakro hinter deine Tabelle einbauen.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Then Exit Sub
If Target.Value > 10 Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
Else
End If
End Sub
Dabei wird die Zelle A1 überwacht und bei Überschreiten des Wertes 10 wird dieser gelöscht.
Viele Grüße
Bernd
MVP für Microsoft Excel
Jetzt neu: Excel-VBA in 21 Tagen, neue FAQs und Makros unter: http://held-office.de
danke für den queltext, aber irgendwie klappts nicht
meine Änderungen:
Private Sub Worksheet_Change2(ByVal Target As Range)
If Target.Address <> "$G$3" Then Exit Sub
If Target.Value > 32 Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
Else
End If
End Sub
es darf nur ein Ereignismakro mit Change geben. du hast das ding in Change2 umbenannt. Das erkennt Excel nicht.
So sollte es heißen:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$G$3" Then Exit Sub
If Target.Value > 32 Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
Else
End If
End Sub
Viele Grüße
Bernd
MVP für Microsoft Excel
Jetzt neu: Excel-VBA in 21 Tagen, neue FAQs und Makros unter: http://held-office.de