Status
Not open for further replies.

guaya81

New Member
Joined
May 9, 2018
Messages
25
I have this macro to run in my workbook but is giving me an error, as a runtime 5 and it was working good in another computer but if I try in my is not working, this macro will filter everything for today's date only

Sub CreditCard()
Application.ScreenUpdating = False
Dim DueDate As String
Dim SlicerMonth As String
DueDate = Format(Date, "dd/mm/yyyy")
SlicerMonth = Format(Date, "mmmm-yy")
Call unselectAllBut("Slicer_Type1", "CREDIT CARD")
Call unselectAllBut("Slicer_Status1", "Open")
Call unselectAllBut("Slicer_MONTH1", SlicerMonth)
Call unselectAllBut("Slicer_Due1", DueDate)
Application.ScreenUpdating = True
End Sub
Sub Withdrawn()
Application.ScreenUpdating = False
Dim DueDate As String
Dim SlicerMonth As String
DueDate = Format(Date, "dd/mm/yyyy")
SlicerMonth = Format(Date, "mmmm-yy")
Call unselectAllBut("Slicer_Type", "Withdrawn")
Call unselectAllBut("Slicer_Status", "Open")
Call unselectAllBut("Slicer_MONTH", SlicerMonth)
Call unselectAllBut("Slicer_Due", DueDate)
Application.ScreenUpdating = True
End Sub


Public Sub unselectAllBut(slicerName As String, newSelection As String)
Dim WB As Workbook
Set WB = Workbooks("EFT_Report_Macro.xlsm")
WB.SlicerCaches(slicerName).SlicerItems(newSelection).Selected = True this line is show as yellow
Dim slc As SlicerItem
Dim slcr As SlicerCache
Dim slc1 As Slicer
For Each slc In ActiveWorkbook.SlicerCaches(slicerName).SlicerItems
If Not slc.Caption = newSelection Then
slc.Selected = False
End If
Next slc
End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Status
Not open for further replies.

Forum statistics

Threads
1,214,792
Messages
6,121,612
Members
449,039
Latest member
Mbone Mathonsi

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