habe folgendes Makro über das füllen der Textboxen einer UF:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim wbDatei, wb As Workbook
Dim wsData As Worksheet
Dim Datei As String
Dim bolOpen As Boolean
Dim aVarData() As String
Dim intY, intA As Integer
Dim strValue As String
Dim Fname
Set wsData = Sheets("Data") ' Datenblatt zuweisen
Application.ScreenUpdating = False
strValue = UfFirmaSuchen.ListBox1.Value ' ausgewählte Zeile in Dropdown
For intY = 2 To 1000 ' Eintrag in Datenbank suchen _
1000 Zeilen nach unten
If wsData.Cells(intY, 1) = "" Then ' wenn leere Zelle gefunden
Exit For ' raus aus Schleife
ElseIf wsData.Cells(intY, 2).Value = strValue Then
Exit For ' ebenso wenn Name _
gefunden
End If
Next
UFData.TextBox1.Value = wsData.Cells(intY, 1).Value 'lf. Nr. rein
UFData.TextBox2.Value = wsData.Cells(intY, 2).Value 'Firmenname
UFData.TextBox3.Value = wsData.Cells(intY, 3).Value 'Anrede
UFData.TextBox4.Value = wsData.Cells(intY, 4).Value 'Titel
UFData.TextBox5.Value = wsData.Cells(intY, 5).Value 'Vorname
UFData.TextBox6.Value = wsData.Cells(intY, 6).Value 'Name
UFData.TextBox7.Value = Format(wsData.Cells(intY, 7).Value, "dd.mm.yyyy") 'Geburtsdatum
UFData.TextBox8.Value = Format(wsData.Cells(intY, 8).Value, "YY") 'Alter
UFData.TextBox9.Value = wsData.Cells(intY, 9).Value 'Briefanrede
UFData.TextBox10.Value = wsData.Cells(intY, 10).Value 'Position
UFData.TextBox11.Value = wsData.Cells(intY, 11).Value 'Straße
UFData.TextBox12.Value = wsData.Cells(intY, 12).Value 'Haus Nr.
UFData.TextBox13.Value = wsData.Cells(intY, 13).Value 'PLZ
UFData.TextBox14.Value = wsData.Cells(intY, 14).Value 'Ort
UFData.TextBox15.Value = wsData.Cells(intY, 15).Value 'letzter Kontakt
UFData.TextBox16.Value = wsData.Cells(intY, 16).Value 'nächster Kontakt
UFData.TextBox17.Value = wsData.Cells(intY, 17).Value 'Verkäufer
UFData.TextBox18.Value = Format(wsData.Cells(intY, 18).Value, "### ###") 'Kundennummer
Application.ScreenUpdating = True
End Sub
Jetzt möchte ich gern die nächsten Datensätze anzeigen lassen mittels CommandButton nach VORN oder nach HINTER(Zurück)
Die UFData ist die Userform.
Vielleicht kann mir jemand helfen ?
mfg Walter MB