PDA

View Full Version : Search by Multiple Criteria and Two Listboxes



Loss1003
03-28-2016, 11:24 AM
Having trouble fixing the attached userform/code to search by a date format.

I can search fine by the Account Name, Number, Department or Requestor. However, I cannot search by the report order date. The code Iím currently appears to be failing to pick up the date format. Iíve tried switching to general formats or setting the format (date) after exiting the OrderD1 comb box. But nothing has worked. Any help is appreciated



If OrderDAnd.Value = True Then
If OrderD1.ListIndex > -1 Then .Range("H4") = "=" & """" & OrderD1.Value & """"
If OrderD2.ListIndex > -1 Then .Range("I4") = "=" & """" & OrderD2.Value & """"
Else 'It's or
If OrderD1.ListIndex > -1 Then .Range("H4") = "=" & """" & OrderD1.Value & """"
If OrderD2.ListIndex > -1 Then .Range("H5") = "=" & """" & OrderD2.Value & """"
End If

.Range("D1", .Range("D65536").End(xlUp)).AdvancedFilter _
Action:=xlFilterCopy, CriteriaRange:="", CopyToRange:=Sheet6.Range("BA1"), Unique:=True
Sheet6.Range("BA1").CurrentRegion.Offset(1, 0).Name = "OrderDat1"
Range("OrderDat1").Sort Key1:=Range("OrderDat1").Cells(1, 1), Order1:=xlDescending, Header:=xlNo
OrderD1.RowSource = "OrderDat1"
OrderD2.RowSource = "OrderDat1"