ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sharing and protecting incompatible? (https://www.excelbanter.com/excel-programming/366714-sharing-protecting-incompatible.html)

[email protected]

sharing and protecting incompatible?
 
Hi,
I'd like to share a workbook made of 3 sheets.
However, I'd like to protect one of the sheets as its content is made
up via macros with the data from the first two sheets.
Unfortunately, the macro will return an error message:

"Unprotect method of Worksheet class failed"
Run-time error '1004'

The macro begins with the following code:
Sheets("Database").Select
ActiveSheet.Unprotect

If I don't share the workbook, the macro works fine.

Is it possible for the macro to unprotect the workbook in order to
perform the data handling?


Dave Peterson

sharing and protecting incompatible?
 
Changing the protection of a worksheet in a shared workbook is not allowed.

But this is documented in Excel's help.
Look for: Features that are unavailable in shared workbooks for a big list.

wrote:

Hi,
I'd like to share a workbook made of 3 sheets.
However, I'd like to protect one of the sheets as its content is made
up via macros with the data from the first two sheets.
Unfortunately, the macro will return an error message:

"Unprotect method of Worksheet class failed"
Run-time error '1004'

The macro begins with the following code:
Sheets("Database").Select
ActiveSheet.Unprotect

If I don't share the workbook, the macro works fine.

Is it possible for the macro to unprotect the workbook in order to
perform the data handling?


--

Dave Peterson

[email protected]

sharing and protecting incompatible?
 
A colleague gave me the solution:
The worksheet was protected to prevent writing, but needed unprotection
to do a "find and replace".
Solution, unlock the relevant column for the "find and replace",
therefore, the macro doesn't need to unprotect the entire sheet. All
columns are protected but that one.

case closed
:-)

PUBA



All times are GMT +1. The time now is 04:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com