ich habe ein Problem mit einer Variable ('var'). Es soll geprüft werden ob der Eintrag in TextBox7 schon vorhanden ist. Es erscheint aber immer die Fehlermeldung 'Typen unverträglich'. Ich habe schon mehrere Typen probiert (Boolean..) aber ich komm net klar.
Hier mal der Code:
Private Sub cmdEintragen_Click()
Dim fehler
Dim count, test
Dim var As Variant
Dim intRow As Integer
Sheets("Daten").Select
fehler = 0
If (TextBox2 = "") Then
MsgBox ("Kein Ort eingetragen.")
fehler = 1
End If
If (TextBox6 = "") Then
MsgBox ("Kein Vorname eingetragen.")
fehler = 1
End If
If (TextBox7 = "") Then
MsgBox ("Kein Name eingetragen.")
fehler = 1
End If
If (TextBox8 = "") Then
MsgBox ("Keine Straße eingetragen.")
fehler = 1
End If
If (TextBox9 = "") Then
MsgBox ("Keine Postleitzahl eingetragen.")
fehler = 1
End If
If (fehler = 1) Then
Else
var = Application.Match(CDbl(TextBox7.Text), Columns(1), 0)
If Not IsError(var) Then
MsgBox "Wert ist bereits vorhanden!"
End If
count = 1
test = 0
While (test = 0)
If ((Cells((count + 3), 1)) = "") Then
test = 1
End If
count = count + 1
Wend
count = count - 1
Cells(count + 3, 1) = count
Cells(count + 3, 2) = TextBox6
Cells(count + 3, 3) = TextBox7
Cells(count + 3, 4) = TextBox8
Cells(count + 3, 5) = TextBox9
Cells(count + 3, 6) = TextBox2
End If
Sheets("Eingabe Maske").Select
Unload Me
End Sub
Vielen Dank für die Hilfe
Henri
P.S. ich wollte eigentlich die Vor- UND Nachnamenbox auf schon vorhanden überprüfen. Vielleicht hat ja jemand auch dazu noch eine Idee.
many THX