Greetings all. I am trying to filter a worksheet where if there is a non-null value in either of two columns, display the entire row. I get complaints from users that the filtering required to come up with different scenarios is too complicated, so I am going to put a series of buttons across the top of the sheet. The below is an example of one where tow columns are both not blank...
Sub Filter_CXM_Bucket()
Dim WS As Worksheet
Set WS = ActiveWorkbook.ActiveSheet
WS.Select
'Check to make sure filter is on, in case user took it off
With Selection
If Not ActiveSheet.AutoFilterMode Then
ActiveSheet.Rows("4:4").AutoFilter
Else
'If it is on, take it off and put it back to reset
.AutoFilter
.AutoFilter
End If
'Apply not-blank criteria to columns 21 and 23
.AutoFilter Field:=21, Criteria1:="<>"
.AutoFilter Field:=23, Criteria1:="<>", Operator:=xlAnd
End With
End Sub
My thought was I could simply change the 'Operator:=xlAnd' to 'Operator:=xlOr', but it did not work. Is there any way to do this? I am using Excel 2003. Thank you.
Greg
Bookmarks