I have a workbook with many sheets. All the sheets and the workbook are protected. I'm using Excel 2016
Two of the sheets contain data from connected Access tables that needs to be refreshed periodically. However, when I click “refresh all” I get an error that the sheet is protected. After I unprotect the sheets and click “refresh all” I get an error message that the workbook is protected. I understand why because the range (and range name) where the Access table refreshes can change if the record count changes. The protected workbook prohibits this.
I need code that I can attach to a button that will:
• Use my password to unprotect worksheet1
• Use my password to unprotect worksheet2
• Use my password to unprotect the workbook
• Refresh All
• Use my password to protect worksheet1
• Use my password to protect worksheet2
• Use my password to protect the workbook
Any help would be appreciated.
Two of the sheets contain data from connected Access tables that needs to be refreshed periodically. However, when I click “refresh all” I get an error that the sheet is protected. After I unprotect the sheets and click “refresh all” I get an error message that the workbook is protected. I understand why because the range (and range name) where the Access table refreshes can change if the record count changes. The protected workbook prohibits this.
I need code that I can attach to a button that will:
• Use my password to unprotect worksheet1
• Use my password to unprotect worksheet2
• Use my password to unprotect the workbook
• Refresh All
• Use my password to protect worksheet1
• Use my password to protect worksheet2
• Use my password to protect the workbook
Any help would be appreciated.