I just finished my first macro but it appears that it running extremely slow and after few loops it's freezes.Before that I have issues with data presentation but I solved it by putting true value in first row.
Point of macro is to show different data on dashboard in each 30 seconds.
Please find my code below:
Public Sub Switch()
Do
With ActiveWorkbook.SlicerCaches("Slicer_country1")
.SlicerItems("NL").Selected = True
.SlicerItems("SP").Selected = False
.SlicerItems("GB").Selected = False
End With
With ActiveWorkbook.SlicerCaches("Slicer_Project1")
.SlicerItems("XX").Selected = True
.SlicerItems("YY").Selected = False
.SlicerItems("ZZ").Selected = False
Application.Wait Now + TimeValue("00:00:30")
End With
With ActiveWorkbook.SlicerCaches("Slicer_Project1")
.SlicerItems("XX").Selected = True
.SlicerItems("YY").Selected = False
.SlicerItems("ZZ").Selected = False
Application.Wait Now + TimeValue("00:00:30")
End With
With ActiveWorkbook.SlicerCaches("Slicer_Project1")
.SlicerItems("XX").Selected = True
.SlicerItems("YY").Selected = False
.SlicerItems("ZZ").Selected = False
Application.Wait Now + TimeValue("00:00:30")
End With
Loop
End Sub
Recent solution with application on time, but it works properly only with last call (I get only wanted field, in first 2 other buttons won't switch off), is there any solution to show only wanted values on each call ?
Dim CallNumber As Integer
Sub ScheduleChange()
Change
Application.OnTime Now + TimeValue("00:00:05"), "ScheduleChange"
End Sub
Sub Change()
CallNumber = CallNumber + 1
With ActiveWorkbook.SlicerCaches("Slicer_Project1")
.SlicerItems("XX").Selected = (CallNumber = 1)
.SlicerItems("YY").Selected = False
.SlicerItems("ZZ").Selected = False
End With
With ActiveWorkbook.SlicerCaches("Slicer_Project1")
.SlicerItems("YY").Selected = (CallNumber = 2)
.SlicerItems("XX").Selected = False
.SlicerItems("ZZ").Selected = False
End With
With ActiveWorkbook.SlicerCaches("Slicer_Project1")
.SlicerItems("ZZ").Selected = (CallNumber = 3)
.SlicerItems("XX").Selected = False
.SlicerItems("YY").Selected = False
End With
If CallNumber = 3 Then
CallNumber = 0
End If
End Sub
Hi again, I use below code but still macro won't show one button at time, it's going from first button to second without deselecting previous one, is there any command to force it to show only one value at time ? Debug shows that Object variable or With block variable not set.
Dim CallNumber As Integer
Sub ScheduleChange()
Change
Application.OnTime Now + TimeValue("00:00:05"), "ScheduleChange"
End Sub
Sub Change()
CallNumber = CallNumber + 1
With ActiveWorkbook.SlicerCaches("Slicer_Project1")
.SlicerItems("XX").Selected = (CallNumber = 1)
.SlicerItems("YY").Selected = (CallNumber = 2)
.SlicerItems("ZZ").Selected = (CallNumber = 3)
End With
If CallNumber = 3 Then
CallNumber = 0
End If
End Sub