Hallo Thomas!
Danke für Deine Antwort.
Funktioniert leider nicht ganz
Bei der Zeile "wks.Cells(1, 1).Offset(1, 0).Select" bekomme ich einen Fehler bei Select
Setze ich diese Zeile außer Kraft dann geht in Excel nichts mehr.
Hier mal der VBA Code
Private Sub TextBox35_AfterUpdate()
Dim wks As Worksheet
Set wks = Workbooks("Masterfile.xls").Worksheets("Tabelle1")
'Sheets("Tabelle1").Select
Const col_datsatz = 1 ' Positionsnummer
Const col_prod = 7 ' Kolonne Hersteller
Const col_posnr = 3 ' Kolonne Kategorie
Const col_preis = 4 'Bundesländer
Const col_bl = 5 'Preis
Const first_row = 2 ' Zeile mit erstem Product
Dim found As Integer
Dim entry_is As Integer
TextBox33 = ""
TextBox40 = ""
Cells(first_row, col_datsatz).Select
'Do Until ActiveCell = "" ' Schleife bis Zelle in Kolonne A leer
Do Until wks.Cells(1, 1) = "" ' Schleife bis Zelle in Kolonne A leer
If TextBox35.Text "" Then
'If InStr(1, ActiveCell.Offset(0, 8), TextBox35.Text, vbTextCompare) > 0 Then
If InStr(1, wks.Cells(1, 1).Offset(0, 8), TextBox35.Text, vbTextCompare) > 0 Then
found = found + 1
End If
Else
found = found + 1
End If
If found = 1 Then
'ListBox1.AddItem ActiveCell
ListBox1.AddItem wks.Cells(1, 1)
entry_is = ListBox1.ListCount 1
'ListBox1.List(entry_is, 1) = ActiveCell.Offset(0, 2)
'ListBox1.List(entry_is, 2) = ActiveCell.Offset(0, 3)
'ListBox1.List(entry_is, 3) = ActiveCell.Offset(0, 4)
'ListBox1.List(entry_is, 4) = ActiveCell.Offset(0, 5)
'ListBox1.List(entry_is, 5) = ActiveCell.Offset(0, 6)
'ListBox1.List(entry_is, 6) = ActiveCell.Offset(0, 7)
'ListBox1.List(entry_is, 7) = ActiveCell.Offset(0, 8)
'ListBox1.List(entry_is, 8) = ActiveCell.Offset(0, 26)
'ListBox1.List(entry_is, 9) = ActiveCell.Offset(0, 27)
'ListBox1.List(entry_is, 10) = ActiveCell.Offset(0, 27)
ListBox1.List(entry_is, 1) = wks.Cells(1, 1).Offset(0, 2)
ListBox1.List(entry_is, 2) = wks.Cells(1, 1).Offset(0, 3)
ListBox1.List(entry_is, 3) = wks.Cells(1, 1).Offset(0, 4)
ListBox1.List(entry_is, 4) = wks.Cells(1, 1).Offset(0, 5)
ListBox1.List(entry_is, 5) = wks.Cells(1, 1).Offset(0, 6)
ListBox1.List(entry_is, 6) = wks.Cells(1, 1).Offset(0, 7)
ListBox1.List(entry_is, 7) = wks.Cells(1, 1).Offset(0, 8)
ListBox1.List(entry_is, 8) = wks.Cells(1, 1).Offset(0, 26)
ListBox1.List(entry_is, 9) = wks.Cells(1, 1).Offset(0, 27)
End If
'ActiveCell.Offset(1, 0).Select
wks.Cells(1, 1).Offset(1, 0).Select
Loop
End Sub
Danke
Josef