z = Range("A2:AP1000").Find(what:=....Falsch
04.08.2005 12:50:54
Peter
mit nachstehendem Code möchte ich Daten die auf einer Userform in die entsprechenden TextBoxen eingegeben werden überspeichern. Die Daten sollen in dei Zeile geschrieben werden wo die Übereinstimmung des Inhaltes von TextBox1 (=Kunden-Nr) steht. Das Eigenartige ist dass es meistens klappt, aber hin und wieder schreibt er die Daten auch in die falsche Zeile....Wer kann da helfen?
Private Sub cmdButton1_Click()
Dim z As Integer, myArr As Variant
Application.ScreenUpdating = False
If TextBox1 = "" Then
ComboBox1.SetFocus
Exit Sub
End If
Sheets("finanzdaten").Activate
z = Range("A2:AP1000").Find(what:=TextBox1).Row
Cells(z, 1) = TextBox1.Value
Cells(z, 2) = TextBox2.Value
Cells(z, 3) = TextBox3.Value
Cells(z, 4) = TextBox4.Value
Cells(z, 5) = TextBox5.Value
Cells(z, 6) = TextBox6.Value
Cells(z, 7) = TextBox7.Value
Cells(z, 8) = TextBox8.Value
Cells(z, 9) = TextBox9.Value
Cells(z, 10) = TextBox10.Value
Cells(z, 11) = TextBox11.Value
Cells(z, 12) = TextBox12.Value
Cells(z, 13) = TextBox13.Value
Cells(z, 14) = TextBox14.Value
Cells(z, 15) = TextBox15.Value
Cells(z, 16) = TextBox16.Value
Cells(z, 17) = TextBox17.Value
Cells(z, 18) = TextBox18.Value
Cells(z, 19) = TextBox19.Value
Cells(z, 20) = TextBox20.Value
Cells(z, 21) = TextBox21.Value
Cells(z, 22) = TextBox22.Value
Cells(z, 23) = TextBox23.Value
Cells(z, 24) = TextBox24.Value
Cells(z, 25) = TextBox25.Value
Cells(z, 26) = TextBox26.Value
Cells(z, 27) = TextBox27.Value
Cells(z, 28) = TextBox28.Value
Cells(z, 29) = TextBox29.Value
Cells(z, 30) = TextBox30.Value
Cells(z, 31) = TextBox31.Value
Cells(z, 32) = TextBox32.Value
Cells(z, 33) = TextBox33.Value
Cells(z, 34) = TextBox34.Value
Cells(z, 35) = TextBox35.Value
Cells(z, 36) = TextBox36.Value
Cells(z, 37) = TextBox37.Value
Cells(z, 38) = TextBox38.Value
Cells(z, 39) = TextBox39.Value
Cells(z, 40) = ComboBox40.Value
Cells(z, 41) = ComboBox41.Value
Cells(z, 42) = ComboBox42.Value
myArr = Sheets("finanzdaten").Range("A2:AP1000")
ComboBox1 = ""
ComboBox1.List = myArr
For iCounter = 1 To 39
Controls("TextBox" & iCounter) = ""
Next iCounter
For eCounter = 40 To 42
Controls("ComboBox" & eCounter) = ""
Next eCounter
End Sub
Vielen Dank
Peter S.