VBA Slicer help


I have code that selects a name on the slicer which is True, it then updates (refreshes), then it goes through unselecting the rest of the names - but while unselecting all the names - it keeps updating and refreshing.

However if i was to do this manually (not using VBA) - i would select the first name, pivot tables refresh and then the rest of the names are auto unselected - can i mimick this in VBA?

Basically its currently faster to run the report in excel by selecting names etc

So can i get vba to select a name from a slicer list, refresh and unselect the other names without all tghe refreshes?


Sub SM()

    With ActiveWorkbook.SlicerCaches("Slicer_PCM_Regional_Sales_Manager")
        .SlicerItems("1_NO REGIONAL SALES MANAGER").Selected = True
         Application.EnableEvents = False
        .SlicerItems("Dave, dennis").Selected = False
        .SlicerItems("Bob, dave").Selected = False
     End With
End Sub

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


pls try to encose your code in

Application.ScreenUpdating = False
'Your code

Application.ScreenUpdating = True

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.