Refresh table on protected worksheets

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings,
I thought I had this under wraps, but something still eludes me. I have a database worksheet "Activity", then I have my worksheet contains the Pivot Table "Auto-Non Auto". I'm use a VBA form, and I have a command botton to launch the maco. I thought I got this right, nothing seems to happen. Offcourse I protected the worksheet "Auto-Non Auto". Any help would greatly be appreciated.

Thank you,

The maco is :
VBA Code:
Private Sub CmdRefresh_Click()
On Error Resume Next

With ActiveSheet
  .Unprotect Password:="mozzer"
  .PivotTable(1).RefreshTable
  .Protect Password:="mozzer", _
        AllowUsingPivotTables:=True
End With
    
End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Greetings,
I thought I had this under wraps, but something still eludes me. I have a database worksheet "Activity", then I have my worksheet contains the Pivot Table "Auto-Non Auto". I'm use a VBA form, and I have a command botton to launch the maco. I thought I got this right, nothing seems to happen. Offcourse I protected the worksheet "Auto-Non Auto". Any help would greatly be appreciated.

Thank you,

The maco is :
VBA Code:
Private Sub CmdRefresh_Click()
On Error Resume Next

With ActiveSheet
  .Unprotect Password:="mozzer"
  .PivotTable(1).RefreshTable
  .Protect Password:="mozzer", _
        AllowUsingPivotTables:=True
End With
   
End Sub
Hey good news, I think this works. I don't see a potential problem.

VBA Code:
Private Sub CmdRefresh_click()
Dim xpt As PivotTable
    With ActiveSheet
        .Unprotect Password:="mozzer"
        For Each xpt In .PivotTables
            xpt.RefreshTable
        Next xpt
    .Protect Password:="mozzer", _
        AllowUsingPivotTables:=True
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,468
Messages
6,130,800
Members
449,595
Latest member
jhester2010

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