protect sheet while being able to update the sheet via macro

hon

Board Regular
Joined
Oct 10, 2005
Messages
73
I have a workbook with multiple sheets in it. One of the worksheet is extracting data from an ODBC datasource. I am trying to protect the datasource sheet from being updated by users. I have tried to hide or protect the sheet but it won't work because it would cause a runtime error in my macro which attempts to refresh the data in the datasource sheet. Even if I can get the protection to work, I would need to password protect the sheet so that none can turn the protection off. In another words, I need to include the password in the macro to unprotect it which still poses a security issue. Any better idea?
 
Figured it out why it is reporting error. The Refreshall is refreshing in the background while the protection is turned back on. Just need to turn that property off and it works!
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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