Hi all,
Having difficulty in understanding how to go about on this one. I am using the below vba code to filter Col. B in Sheet 2 based on the names in Col. L in Sheet 1 (the name range is dynamic). Sheet 2 will apply filter based on the values in Sheet 1 in Range L:L, count the number of visible rows, return the count in Sheet 1 in Range C6 and then delete the rows. I could only go not even half way through from the below code. It only filters by the first name written in column L. Please suggest.
Thanks in advance
Having difficulty in understanding how to go about on this one. I am using the below vba code to filter Col. B in Sheet 2 based on the names in Col. L in Sheet 1 (the name range is dynamic). Sheet 2 will apply filter based on the values in Sheet 1 in Range L:L, count the number of visible rows, return the count in Sheet 1 in Range C6 and then delete the rows. I could only go not even half way through from the below code. It only filters by the first name written in column L. Please suggest.
VBA Code:
Sub Filterbyname()
Dim InputSt As Worksheet,
Dim NameSt As Worksheet
Dim List As Variant
Dim InputLR As Long
Set NameSt = Sheets("Sheet2")
Set InputSt = Sheets("Sheet1")
InputSt.Activate
With InputSt
InputLR = InputSt.Cells(InputSt.Rows.count, "L").End(xlUp).Row
List = Range(Cells(1, 12), Cells(InputLR, 12)).Value
End With
NameSt.Activate
ActiveSheet.Range("B2").AutoFilter Field:=2, Criteria1:=List, Operator:=xlFilterValues
End Sub
Thanks in advance