Autofilter not resulting in an expected Manner with VBA coding

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
684
Hello

Somehow the below coding does not result for exact Autofilter execution
VBA Code:
Private Sub AFM_NotFunctioning_As Per_Expectation ()

Dim wks1 As Worksheet, wks2 As Worksheet, wks3 As Worksheet
Dim lastUsdRowWks2 AS Long, lastUsdRowWks1 AS Long
Dim MangrsNameArr As Variant

Set Wks1 = Worksheets("MANAGER NAMES")
Set wks2 = Worksheets("PYMNTS")

lastUsdRowWks2 = wks2.Range("A" & Rows.Count).End(xlUp).Row
lastUsdRowWks1 = wks1.Range("A" & Rows.Count).End(xlUp).Row

MangrsNameArr = Wks1.Range("A2:A11").Value
 
wks2.Range("A1:K1").AutoFilter Field:=4, Criteria1:=MangrsNameArr, Operator:=xlFilterValues

End Sub
The Above Syntax only shows one record of only one manager in Wks2 and not the records of other managers as per the List range in column A2: A11 of wks1
The Manager Names are also there in wks2 colunm D to match the Criteria List Name of Managers as per Wks1

Kindly Help me to achieve what i desire

Thanks
NimishK
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,215,506
Messages
6,125,194
Members
449,214
Latest member
mr_ordinaryboy

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