A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Do you have VBA code in the button? You'll need to add to it to unprotect the sheet, then refresh and then protect it afterwards.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Trying to use a refresh button for a pivot table, but I need to protect the worksheet. Currently, when I protect the worksheet, the button comes back as a run-time error 1004. The button works fine when the sheet is unprotected.
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Do you have VBA code in the button? You'll need to add to it to unprotect the sheet, then refresh and then protect it afterwards.
I do have VBA code in it
Sub Button5_Click()
ActiveSheet.PivotTables(2).PivotCache.Refresh
End Sub
what would I need to add to it? Thanks!
This page should help you:
https://docs.microsoft.com/en-us/office/vba/api...
If you have a password, you'll need to add it.
I added that to my code and I'm still getting the error when I protect the sheet
How are you protecting it?