in einer userform liste ich per suchabfrage daten aus
der tabelle(DB).die daten erscheinen dann in der
userform mit 9stk. textboxen.
meine frage:
warum kann ich die daten nicht ändern in den
9 textboxen.Wenn die daten schon da sind möchte ich ich sie in jeder textbox ändern können??
mein code:
Private Sub UserForm_Initialize()
ComboBox1.RowSource = "DB!A1:A" & Sheets("DB").Range("A65536").End(xlUp).Row
ListBox3.ColumnCount = 11
ListBox3.RowSource = "DB!A1:K" & Sheets("DB").Range("K65536").End(xlUp).Row
'listbox spalten breite einstellen
Dim i As Integer
i = ActiveSheet.UsedRange.Rows.Count
ListBox1.ColumnWidths = "6 Pt"
'ListBox3.ColumnCount = 8
With UserForm1.ComboBox1
i = ActiveSheet.UsedRange.Rows.Count
With UserForm1.ComboBox1
.ColumnCount = 1
.ColumnHeads = False
.ColumnWidths = "8cm;"
End With
End With
End Sub
Private Sub Userform_Activate()
Suche.Caption = "Suche"
End Sub
'suchen
Private Sub Suche_Click()
On Error Resume Next
If Err.Number <> 0 Then
MsgBox "Kein Eintrag vorhanden!", vbCritical, "Schreiben Sie was rein"
End If
Dim s As String
Dim Found As Range
Dim FirstAddress As String
Dim i As Integer ' Zeile
i = 0
If ComboBox1.Text = "" Then
MsgBox "Kein Eintrag vorhanden!", vbCritical, "Was soll ich den suchen?"
txtSuche.SetFocus
Else
End If
Eingabe = ComboBox1.Text
If Eingabe = "" Then Exit Sub
ListBox1.Clear
ListBox2.Clear
With ActiveSheet
Set Found = .Cells.Find(Eingabe, LookAt:=xlPart)
If Not Found Is Nothing Then
FirstAddress = Found.Address
ListBox1.ColumnCount = 1
ListBox1.AddItem Found
ListBox1.List(i, 1) = Cells(Found.Row, 13)
ListBox2.AddItem Found.Row
i = i + 1
Do
Found.Activate
Set Found = Cells.FindNext(After:=ActiveCell)
On Error Resume Next
If Found.Address = FirstAddress Then Exit Do
ListBox1.AddItem Found
ListBox1.List(i, 1) = Cells(Found.Row, 13)
ListBox2.AddItem Found.Row
i = i + 1
Loop
End If
End With
Suche.Caption = "Neue Suche"
End Sub
'Hier erfolgt die Ausgabe des gesuchten
'in einer combobox per Auswahl in der ListBox
Private Sub ListBox1_Click()
If ListBox1.Value <> "" Then
On Error Resume Next
ListBox2.ListIndex = ListBox1.ListIndex
txtNachname = Cells(ListBox2.Value, 1) & " " & Cells(ListBox2.Value, 2)
txtPlz = Cells(ListBox2.Value, 3) & " " & Cells(ListBox2.Value, 4)
txtAdresse = Cells(ListBox2.Value, 5)
txtTelefon = Cells(ListBox2.Value, 6)
txtHandy = Cells(ListBox2.Value, 7)
txtFax = Cells(ListBox2.Value, 8)
txtEmail = Cells(ListBox2.Value, 9)
txtKennung = Cells(ListBox2.Value, 10)
txtAnmerkung = Cells(ListBox2.Value, 11)
End If
End Sub
wer kann mir helfen
danke