Private Sub CommandButton1_Click()
Date1 = CLng(DateValue(Me.Date10.Text))
Date2 = CLng(DateValue(Me.Date20.Text))
With Sheets("data")
lr = .Cells(Rows.Count, "B").End(xlUp).Row
.Range("B1").AutoFilter
.Range("B1").AutoFilter Field:=2, Criteria1:=">=" & Date1, Operator:=xlAnd, _
Criteria2:="<=" & Date2
.Range("A1:I" & lr).SpecialCells(xlCellTypeVisible).Copy Sheets("reports").Range("B2")
.AutoFilterMode = False
End With
Range("A:A").ColumnWidth = 5
Columns("B:C").ColumnWidth = 9
Columns("D:H").ColumnWidth = 25
Columns("I:J").ColumnWidth = 9
Cells.Select
With Selection
.VerticalAlignment = xlCenter
End With
Columns("D:H").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
End With
Range("B2").Select
End Sub
Private Sub CommandButton3_Click()
With Sheets("data")
lr = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A1").AutoFilter
.Range("A1").AutoFilter Field:=1, Criteria1:=Me.ComboBox1
.Range("A1:I" & lr).SpecialCells(xlCellTypeVisible).Copy Sheets("reports").Range("B2")
.AutoFilterMode = False
End With
Range("A:A").ColumnWidth = 5
Columns("B:C").ColumnWidth = 9
Columns("D:H").ColumnWidth = 25
Columns("I:J").ColumnWidth = 9
Cells.Select
With Selection
.VerticalAlignment = xlCenter
End With
Columns("D:H").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
End With
Range("B2").Select
End Sub
Private Sub CommandButton7_Click()
With Sheets("data")
lr = .Cells(Rows.Count, "I").End(xlUp).Row
.Range("I1").AutoFilter
.Range("I1").AutoFilter Field:=9, Criteria1:=Me.ComboBox2
.Range("A1:I" & lr).SpecialCells(xlCellTypeVisible).Copy Sheets("reports").Range("B2")
.AutoFilterMode = False
End With
Range("A:A").ColumnWidth = 5
Columns("B:C").ColumnWidth = 9
Columns("D:H").ColumnWidth = 25
Columns("I:J").ColumnWidth = 9
Cells.Select
With Selection
.VerticalAlignment = xlCenter
End With
Columns("D:H").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
End With
Range("B2").Select
End Sub
Private Sub Date10_AfterUpdate()
If Not IsDate(Me.Date10.Value) Then
Me.Date10.Text = ""
MsgBox "Please Type a Valid Date!"
Exit Sub
End If
End Sub
Private Sub Date20_AfterUpdate()
If Not IsDate(Me.Date20.Value) Then
Me.Date20.Text = ""
MsgBox "Please Type A Valid Date!"
Exit Sub
End If
End Sub