could any of u guru's please have a look at this code and tell me whats wrong..
the command button is on sheet 3 where cells D4 and G4 have from / to dates. i.e d4 = 01/03/03 g4 = 31/03/03
sheet one is called voucher -column 1 is a date column.
the code should goto sheet 1,highlight column1 filter it and print.
Private Sub CommandButton1_Click()
Dim StartDate As Date
Dim EndDate As Date
Range("D4").Value = "startdate"
Range("G4").Value = "enddate"
Sheets("Voucher").Select
Columns("A:A").Select
Range("A7:A2100").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=">=startdate", Operator:=xlAnd _
, Criteria2:="<=enddate"
Selection.PrintOut Copies:=1, Collate:=True
End Sub
the command button is on sheet 3 where cells D4 and G4 have from / to dates. i.e d4 = 01/03/03 g4 = 31/03/03
sheet one is called voucher -column 1 is a date column.
the code should goto sheet 1,highlight column1 filter it and print.
Private Sub CommandButton1_Click()
Dim StartDate As Date
Dim EndDate As Date
Range("D4").Value = "startdate"
Range("G4").Value = "enddate"
Sheets("Voucher").Select
Columns("A:A").Select
Range("A7:A2100").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=">=startdate", Operator:=xlAnd _
, Criteria2:="<=enddate"
Selection.PrintOut Copies:=1, Collate:=True
End Sub