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 are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Status
Not open for further replies.

Forum statistics

Threads
1,214,835
Messages
6,121,880
Members
449,057
Latest member
Moo4247

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