Two filters

kl88

New Member
Joined
Jun 30, 2011
Messages
15
Hello !

I am having a slight problem with creating my macro.
I'm supposed to create a tracking tool, in which theres several columns of information. But there are two columns i want the macro to filter on.
On C/D number and on Remarks. But the problem is, the two are not always filled in equally.

For example
C/D nummer------- Remarks
1234 ------------- (empty)

So now only 1 column has a value in it, but if i filter it will filter only on rows with both columns filled in, but i also need the ones with only 1 column filled in.

For now this is what i have
Code:
Sub ShowUnfinished()
Sheet1.Activate
'Turn of any filter
If ActiveSheet.AutoFilterMode Then
    If ActiveSheet.FilterMode Then
        ActiveSheet.ShowAllData
    End If
ElseIf ActiveSheet.FilterMode Then
    ActiveSheet.ShowAllData
End If
'Select unfinished SBR's
With Worksheets("Sheet1")
  .Cells.AutoFilter Field:=16, Criteria1:="="
  .Cells.AutoFilter Field:=24, Criteria1:="<>"
End With
End Sub

I hope i made the problem clear and that someone knows the anwser
Any help will be appreciated !
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Your filter on field 24 is filtering on 'Non blank' cells. You best use two Sub's, one for field 16 and one for field 24.
 
Upvote 0
Hey , thanks for the response

But i dont understand how using two subs is supposed to help.
If i filter 16 first and then 24 in different subs i will still get the same result of getting only anwsers in which they are both filled in.

I need to get all rows in which 1 of the two is filled in one simple button click
 
Upvote 0
As your filter on field 24 is filtering on '<>', which means 'Non blanks' then only cells with value will be shown in that particular column.
To show CD-numbers even if the remarks are empty then you should only filter on CD-numbers.

Success
Erik
 
Upvote 0
The problem is , sometimes the c/d nummer is not filled in and only the remark colum is. I wos thinking about using advanced criteria, any idea if that could work ?
 
Upvote 0
No solution for that, you just have to filter on 16 or 24, not both at the same time.
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,135
Members
452,890
Latest member
Nikhil Ramesh

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