I have a code that filters the values from a worksheet (let's name it filter worksheet) depending on the values in a list (in the result worksheet), this list is variable and sometimes the values in it are the same/duplicated, for example:
So in the filter worksheet, it filters values 5 and 6 and pastes them on the result worksheet. But since the value "5" is duplicated, I'd like for the filtered value to be duplicated as well. Does anybody know if it could be done via vba or maybe via an excel formula?
Here is the code section of the filtered data:
Thank you in advance!
So in the filter worksheet, it filters values 5 and 6 and pastes them on the result worksheet. But since the value "5" is duplicated, I'd like for the filtered value to be duplicated as well. Does anybody know if it could be done via vba or maybe via an excel formula?
Here is the code section of the filtered data:
VBA Code:
With ActiveSheet
With Range("A23:AG115")
.AutoFilter Field:=1, Operator:=xlFilterValues, _
Criteria1:=Split(Join(Application.Transpose(wsResult.Range("L2:L8")), ","), ",")
End With
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("O24:O" & LR).SpecialCells(xlCellTypeVisible).Select
Selection.Copy
End With
wsResult.Activate
wsResult.Range("M3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Thank you in advance!
Last edited by a moderator: