Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good day,
I need to create a User Form (Excel 2003) that allows users to enter 5 filter criteria. Each filter must allow input for a single Column letter (e.g., A, B, C), single operand (e.g., =, , <, ) and single criteria (e.g., A1500, 100.00). Any suggestions? I tried building a filter string (shown below). ***** Dim strField1 As String, ... 'Filter 1 strFilter = IIf(Me.txtField1.Value = "", "", _ ".AutoFilter Field:=" & Me.txtField1.Value & ", " & _ "Criteria:='" & Me.cboOperand1.Value & Me.txtValue1.Value & "'") 'Filter 2 strFilter = IIf(Me.txtField2.Value = "", strFilter, _ strFilter & ", Operator:=xlAnd .AutoFilter Field:=" & Me.txtField2.Value & ", " & _ "Criteria:='" & Me.cboOperand2.Value & Me.txtValue2.Value & "'") '(same code for Filters 3, 4, and 5) 'Run the filter If strFilter = "" Then MsgBox "You must enter at least one filter." GoTo Exit_Sub Else Set rng = ActiveSheet.AutoFilter.Range With rng strFilter End With End If 'Exit sub Exit_Sub: Exit Sub 'Error handler Err_Handler: MsgBox "Error: " & Err GoTo Exit_Sub End Sub ***** Regards, Dan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Filter Multiple Columns on Multiple Criteria and count the last co | Excel Worksheet Functions | |||
User form to change manual field filter in pivot table | Excel Discussion (Misc queries) | |||
Filter Excel Pivot, based on user entry form | Excel Discussion (Misc queries) | |||
Filter Listbox in user form | Excel Programming | |||
User form search criteria example | Excel Programming |