Dont know why im getting error 1004 object error

mahmed1

Well-known Member
Joined
Mar 28, 2009
Messages
2,302
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi All,

Im trying to highlight all values in the slicer that has the word leaver in there but im getting this error 1004 application or object error

The slicer name to use in formulas is called Slicer_Area1

Here is the code used with power pivot (pivot tables)

Code:
Sub SelectLeavers()


Dim slcr As SlicerCache
Dim slc As Slicer
Dim si As SlicerItem


Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual


 For Each si In ActiveWorkbook.SlicerCaches("Slicer_Area1").SlicerItems
   If InStr(si.Name, "Leaver") > 0 Then
      si.Selected = True
   Else
      si.Selected = False
   End If
 Next si


Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic


Application.DisplayAlerts = False
    ActiveWorkbook.RefreshAll
Application.DisplayAlerts = False


End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Apparently its to do with power Pivot slicers. How can i get around it to select items in the slicer that has leaver in there
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,662
Latest member
Aman1997

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