Excel Timeline slicer set date range with VBA

mdenne

New Member
Joined
Sep 9, 2014
Messages
6
I am trying to set a Timeline date range using VBA.

Code:
sub DateTest()
Dim sd as Date
Dim ed as Date
sd = Sheets("Stuff").Range("B11").Value
ed = Sheets("Stuff").Range("C11").Value

Sheets("Charts").Shapes.Range(Array("Date6")).Select
ActiveWorkbook.SlicerCaches("NativeTimeline_Date6").TimelineState.SetFilterDateRange sd, ed
end sub

It seems to select the timeline as I see the border light up but it does not change the the date range, no errors occur the sub just stops without updating the date range. I checked my references to the dates and they are formatted as a date "10/01/2016". I even directly tried putting in the date instead of sd and ed and still no update of the timeline.

Any help would be grateful.

Thanks
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top