I've been trying to make a selection on a range in one page and then put the values of that array in a slicer on an other page. I've been looking into the answers provided, but the program keeps throwing error 1004 at me in the code line For Each item In .SlicerItems. I've then tried putting in the "hard" text values , but still nothing.
Any help would be appreciated!
Any help would be appreciated!
VBA Code:
Sub SlicerUpdate()
Dim wb As Workbook
Dim dbWS As Worksheet
Dim dbWS2 As Worksheet
Dim lbText As String
Dim vItems As Variant
Dim vMatchVal As Variant
Dim item As SlicerItem
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Set wb = ThisWorkbook
Set dbWS = Sheets("Voortgang kosten in tijd")
Sheets("Realisatie NoPMO TFT per proj").Select
vItems = Selection.Range("a2:A5")
Sheets("Voortgang kosten in tijd").Select
'vItems = "330521"
lbText = "330521"
ActiveSheet.Shapes.Range(Array("Rimses werkorder code")).Select
With wb.SlicerCaches("Slicer_Rimses_werkorder_code")
.ClearManualFilter
[COLOR=rgb(184, 49, 47)]For Each item In .SlicerItems[/COLOR]
vMatchVal = Application.Match(item.Name, vItems, 0)
If IsError(vMatchVal) Then
item.Selected = False
End If
Next item
End With
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlAutomatic
End Sub