I have 2 txt boxes on a form which are datepickers. txtDateBox2 is for entering the start date, and txtDateBox3 is for enterning the ending date.
When cmdGetReport button is selected I need the code to filter the dates that are in column B on the worksheet ("Seatex Incident Log") in the set range based on those 2 dates. I cant figure out why I am getting error '448' Named argument not found. ?? Thanks for any help in getting this working for me.
Here is my code:
When cmdGetReport button is selected I need the code to filter the dates that are in column B on the worksheet ("Seatex Incident Log") in the set range based on those 2 dates. I cant figure out why I am getting error '448' Named argument not found. ?? Thanks for any help in getting this working for me.
Here is my code:
Code:
Private Sub cmdGetReport_Click()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Dim rCol As Long
Dim ws As Worksheet
Dim W1Startdate As String, W1Enddate As String
Set ws = Worksheets("Seatex Incident Log")
W1Startdate = Format(Date, "mm/dd/yyyy")
W1Enddate = Format(Date, "mm/dd/yyyy")
Me.txtDateBox2 = W1Startdate ' "FROM" date
Me.txtDateBox3 = W1Enddate ' "TO" date
rCol = Sheets("Seatex Incident Log").UsedRange.Rows.Count
Range(Cells(18, 1), Cells(rCol, 29)).Select
Range(Cells(18, 1), Cells(rCol, 29)).Activate
ActiveWorkbook.Worksheets("Seatex Incident Log").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Seatex Incident Log").AutoFilter Field:=2, Criteria1:=">=" & W1Startdate, Criteria2:="<=" & W1Enddate
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub