Hi all,
I'm looking for some help with a macro to filter a specific column containing values from a list on a separate tab.
Basically I have 2 sheets in my workbook:
Any ideas how I can get this to work?
Thanks
I'm looking for some help with a macro to filter a specific column containing values from a list on a separate tab.
Basically I have 2 sheets in my workbook:
- Sheet 1: contains a dynamic list of values that users need to copy/paste from a different source
- Sheet 2: contains a table of data, with column E (5) that needs to be filtered for all values contained in the list on sheet 1. This means exact matches and partial matches.
Any ideas how I can get this to work?
Thanks
VBA Code:
Sub Filter_Scope()
Dim count As Integer
Dim list As Variant
Sheet1.Activate
count = WorksheetFunction.CountA(Range("A4", Range("A4").End(xlDown)))
list = Split(Join(Application.Transpose(Range(Cells(4, 1), Cells(count, 1)).Value), ","), ",")
Sheet2.Activate
ActiveSheet.Range("A1").Autofilter Field:=5, Criteria1:=list, Operator:=xlFilterValues
End Sub