Help with filter

AlbertRBrowne

New Member
Joined
Jun 25, 2011
Messages
6
I am using a Form with the code below to filter a range on my spreadsheet the filter works ok with field 1 and 2 commented out. But if I activate them the wildcard "*" fails and no records are selected. Field 1 contains a date field 2 contains a calculated week number. If I add a value to these fields the filter works ok. The form boxes contains the * by default. Field 1 and 2 are text boxes the rest are combo boxes. Can anyone help to get this to work?

Thanks,

Albert

Code:
'Apply Filter

Private Sub FilterButton_Click()
    
    Dim FDate As String, FWeek As String, FSeries As String, FModel As String, FProductType As String, FDept As String, FRootCause As String
    
    ActiveSheet.AutoFilterMode = False
    
    FDate = Filter.DateTxtBox.Value
    FWeek = Filter.WeekTxtBox.Value
    FSeries = Filter.SeriesCmbBox.Value
    FModel = Filter.ModelTypeCmbBox.Value
    FProductType = Filter.ProductTypeCmbBox.Value
    FDept = Filter.DeptCmbBox.Value
    FRootCause = Filter.RootCauseCmbBox.Value
   
    With ActiveSheet
        .AutoFilterMode = False
        .Range("D29:N279").AutoFilter
        .Range("D30:N279").AutoFilter field:=1 ', Criteria1:=FDate, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=2 ', Criteria1:=FWeek, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=3, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=4, Criteria1:=FSeries, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=5, Criteria1:=FModel, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=6, Criteria1:=FProductType, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=7, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=8, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=9, Criteria1:=FDept, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=10, Criteria1:=FRootCause, visibledropdown:=False
        .Range("D30:N279").AutoFilter field:=11, visibledropdown:=False
    End With
        
    Unload Me
    
        
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,224,567
Messages
6,179,569
Members
452,926
Latest member
rows and columns

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top