is possible filter data based on two values in the same filtered column

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,429
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
hello
i'm asking about filter data based on two names on the same filtered column in column 3 (c) for instance if i write in e3 and f3 the names based on sheet1 in colm 3 is it possible do that ? if is possible i hope somebody help i try amending but it gives me error
VBA Code:
Sub Test1()

       Dim CID As String: CID = sheet2.[e3].Value
       Dim CID1 As String: CID1 = sheet2.[f3].Value
        Dim FromDt As Long: FromDt = sheet2.[d3].Value
        Dim ToDt As Long: ToDt = sheet2.[c3].Value

Application.ScreenUpdating = False
    
        sheet2.[A5].CurrentRegion.Offset(1).Clear
    
        With sheet1.[A2].CurrentRegion
               .AutoFilter 3, CID, CID1
                .AutoFilter 2, ">=" & FromDt, xlAnd, "<=" & ToDt
                .Offset(1).EntireRow.Copy sheet2.Range("A" & Rows.Count).End(3)(2)
                .AutoFilter
        End With
    
Application.ScreenUpdating = True

End Sub
thanks
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
It needs to be
VBA Code:
.AutoFilter 3, CID, xlor, CID1
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,996
Messages
6,122,636
Members
449,092
Latest member
bsb1122

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