Zielbereich in einem MAKRO
19.05.2005 09:06:34
Benny
ich habe da ein kleines Problem mit dem Zielbereich in einem Makro. Das Makro soll sich nur auf eine Zelle beziehen! Es reagiert aber bei Eingabe in jeder Zelle des Tabellenblattes!
Wie kann ich es auf eine Zelle beschränken! Hier mein Code:
Private Sub Worksheet_Change(ByVal target As Range)
Dim x%, y%
Dim text01 As String
Dim text02 As String
x = target.Column = 3
y = target.Row = 3
text01 = "7004"
text02 = "7013"
text03 = "7023"
text04 = "7024"
text05 = "7102"
text06 = "7113"
text07 = "7122"
text08 = "7152"
text09 = "7153"
text10 = "7202"
text11 = "7203"
text12 = "7213"
text13 = "7222"
text14 = "7303"
text15 = "7304"
text16 = "7313"
text17 = "7804"
text18 = "7904"
text19 = "7914"
text20 = "7954"
text21 = "7955"
If target.Value = text01 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text02 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text03 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text04 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text05 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text06 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text07 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text08 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text09 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text10 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text11 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text12 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text13 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text14 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text15 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text16 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text17 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text18 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text19 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text20 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
ElseIf target.Value = text21 Then
MsgBox ("Bitte Versatz angeben !!!")
SendKeys "{esc}"
End If
End Sub