mit folgenden Code durchsuche ich das aktuelle Tabellenblatt (nach Inhalt Spalte AA):
Private Sub TextBox1_Change()
Dim arr() As Variant, tmp As Variant, wks As Worksheet, wks1 As Worksheet, bolmatch
Dim index As Integer, intindex1
Dim x, icount, wert As Currency
ListBox1.Clear
awks = ActiveSheet.Name
Set wks = Sheets(awks)
x = wks.Range("A65536").End(xlUp).Row
tmp = wks.Range("AA8:AA" & x)
If TextBox1 = "" Then
ListBox1.Clear
Else
For index = 1 To UBound(tmp, 1)
bolmatch = InStr(1, tmp(index, 1), TextBox1, vbTextCompare) > 0
If bolmatch Then
ReDim Preserve arr(0 To 5, 0 To icount)
arr(0, icount) = wks.Cells(index + 7, 1)
arr(1, icount) = wks.Cells(index + 7, 2)
arr(2, icount) = wks.Cells(index + 7, 3)
arr(3, icount) = wks.Cells(index + 7, 24)
arr(4, icount) = VBA.Format(wks.Cells(index + 7, 30), "0.00")
arr(5, icount) = index + 7
icount = icount + 1
End If
Next
End If
If icount 0 Then
ListBox1.Column = arr
Else
ListBox1.Clear
End If
wert = 0
For intindex1 = 0 To ListBox1.ListCount - 1
wert = wert + ListBox1.List(intindex1, 4)
Next intindex1
Label13 = VBA.Format(wert, "0.00") & " "
End Sub
Momentan ist das aktuelle Blatt "Februar".
Wie kann ich nun erreichen dass bei Bedarf (z.B. bei anhaken einer Checkbox), weitere Tabellenblätter durchsucht werden? (Januar - Dezember).
Danke für eure Mühen.
Möchte ungern was hochladen - sensible Daten!!
otto