rcarmichael
New Member
- Joined
- Aug 10, 2012
- Messages
- 29
- Office Version
- 2016
- Platform
- Windows
Good morning all,
I have already searched on this and other forums for where I'm going wrong, but nothing I've found has helped...
I am trying to filter a year-based slicer from the values in two cells. The code I've got so far works if &[Year1] is changed to &[2022] etc., but trying to pull in the actual cell value from A3 or A6 respectively throws an error.
The code I have so far is:
Sincere regards,
Ryan
I have already searched on this and other forums for where I'm going wrong, but nothing I've found has helped...
I am trying to filter a year-based slicer from the values in two cells. The code I've got so far works if &[Year1] is changed to &[2022] etc., but trying to pull in the actual cell value from A3 or A6 respectively throws an error.
The code I have so far is:
Any assistance is greatly appreciated,Sub Sales_Overview()
'
' Sales_Overview Macro
'
'
Dim Year1 As Long
Dim Year2 As Long
Year1 = Worksheets("Sales Overview").Cells(3, "A").Value
Year2 = Worksheets("Sales Overview").Cells(6, "A").Value
ActiveWorkbook.SlicerCaches("Slicer_Calendar").VisibleSlicerItemsList = Array( _
_
"[Date].[Calendar].[Year].&[Year1]", "[Date].[Calendar].[Year].&[Year2]")
End Sub
Sincere regards,
Ryan