Case Absage funktioniert nicht
10.08.2007 08:22:00
Phil
Kann mir bitte wer sagen warum meine Case-Abfrage nicht funtkioniert?
Private Sub CommandButton1_Click()
Dim chkCaption1 As String
Dim chkCaption2 As String
Dim chkCaption3 As String
Dim chkCaption4 As String
Dim chkCaption5 As String
Dim chkCaption6 As String
Dim chkCaption As Boolean
chkCaption1 = CheckBox1.Caption
chkCaption2 = CheckBox2.Caption
chkCaption3 = CheckBox3.Caption
chkCaption4 = CheckBox4.Caption
chkCaption5 = CheckBox5.Caption
chkCaption6 = CheckBox6.Caption
Monate = ListBox1.Value
Select Case chkCaption
Case Is = CheckBox1.Value = True
Sheets(Monate).Activate
Selection.AutoFilter Field:=5, Criteria1:=chkCaption1
ActiveSheet.Range("A2:H" & ActiveSheet.UsedRange.Rows.Count). _
SpecialCells(xlCellTypeVisible).Copy
Sheets(".").Cells(1, 1).PasteSpecial Paste:=xlPasteValues
Case Is = CheckBox2.Value = True
Sheets(Monate).Activate
Selection.AutoFilter Field:=5, Criteria1:=chkCaption2
ActiveSheet.Range("A2:H" & ActiveSheet.UsedRange.Rows.Count). _
SpecialCells(xlCellTypeVisible).Copy
Sheets(".").Cells(1, 1).PasteSpecial Paste:=xlPasteValues
Case Is = CheckBox3.Value = True
Sheets(Monate).Activate
Selection.AutoFilter Field:=5, Criteria1:=chkCaption3
ActiveSheet.Range("A2:H" & ActiveSheet.UsedRange.Rows.Count). _
SpecialCells(xlCellTypeVisible).Copy
Sheets(".").Cells(1, 1).PasteSpecial Paste:=xlPasteValues
Case Is = CheckBox4.Value = True
Sheets(Monate).Activate
Selection.AutoFilter Field:=5, Criteria1:=chkCaption4
ActiveSheet.Range("A2:H" & ActiveSheet.UsedRange.Rows.Count). _
SpecialCells(xlCellTypeVisible).Copy
Sheets(".").Cells(1, 1).PasteSpecial Paste:=xlPasteValues
Case Is = CheckBox5.Value = True
Sheets(Monate).Activate
Selection.AutoFilter Field:=5, Criteria1:=chkCaption5
ActiveSheet.Range("A2:H" & ActiveSheet.UsedRange.Rows.Count). _
SpecialCells(xlCellTypeVisible).Copy
Sheets(".").Cells(1, 1).PasteSpecial Paste:=xlPasteValues
End Select
End Sub
Und, ich würde gerne vor jedem einfügen der Daten die Tabelle löschen, ansonsten habe ich gemischte Werte in meiner Tabelle.
Greetz
Phil