HERBERS Excel-Forum - das Archiv

Thema: Filtern mit VBA | Herbers Excel-Forum

Filtern mit VBA
ABO

Hallo zusammen,
das folgende Makro funktioniert in Excel 2003 leider nicht. Warum?
Private Sub ComboBox1_Change()
ComboBox1.Value = Format(ComboBox1.Value, "0000")
End Sub


Private Sub ComboBox2_Change()
ComboBox2.Value = Format(ComboBox2.Value, "dd.mm.yyyy")
End Sub


Private Sub ComboBox3_Change()
ComboBox3.Value = Format((ComboBox3.Value), "00.00 €")
End Sub


Private Sub CommandButton4_Click()
Unload Me
End Sub


Private Sub CommandButton1_Click()
Selection.AutoFilter Field:=1, Criteria1:=">=" & CDbl(ComboBox1.Value), _
Operator:=xlAnd, _
Criteria2:="<=" & CDbl(ComboBox1.Value)
End Sub


Private Sub CommandButton2_Click()
Selection.AutoFilter Field:=2, Criteria1:=">=" & CDbl(CDate(ComboBox2.Value)), _
Operator:=xlAnd, _
Criteria2:="<=" & CDbl(CDate(ComboBox2.Value))
End Sub


Private Sub CommandButton3_Click()
Selection.AutoFilter Field:=3, Criteria1:=">=" & CDbl(ComboBox3.Value), _
Operator:=xlAnd, _
Criteria2:="<=" & CDbl(ComboBox3.Value)
End Sub


Private Sub CommandButton5_Click()
Selection.AutoFilter Field:=4, Criteria1:=ComboBox4.Value
End Sub


Private Sub CommandButton27_Click()
On Error GoTo fehler
ComboBox1.ListIndex = -1
ComboBox2.ListIndex = -1
ComboBox3.ListIndex = -1
ComboBox4.ListIndex = -1
ActiveSheet.ShowAllData
Range("A4").Select
Exit Sub
fehler:
MsgBox "Es wird schon alles angezeigt!"
End Sub

In Excel 2003 bekomme ich folgende Fehlermeldung:
Fehler beim Kompilieren: Projekt oder Bibliothek nicht gefunden. ("Format")
In Excel 2007 z.B. Funktioniert es!
Wie oder was muss man ändern damit es auch in Excel 2003 funktioniert.
Im Voraus vielen Dank!
Gruß ABO

..warum neuer Beitrag?..
robert

AW: ..warum neuer Beitrag?..
ABO

Hallo Robert,
Sorry, ich habe deinen Beitrag zu spät gesehen!
Ich habe deine Datei heruntergelden, und diese Funktioniert.
Was ich bei meiner falsch gemacht habe, keine Ahnung.
Danke noch mal an alle die mir bei meinem Problem weitergeholfen haben.
Gruß ABO