VBA issue

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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Status
Not open for further replies.

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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