ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel protection & macros (https://www.excelbanter.com/excel-discussion-misc-queries/176556-excel-protection-macros.html)

Neil Pearce

Excel protection & macros
 
Dear all,

I would like to protect my spreadsheet so that others might use it. However
when I do so the macros in the workbook do not run. I may select the button
that they are attached to but the marco itself doesn't run.

Which settings do I change to alter this situation?


Thanks in advance,

Neil

John Bundy

Excel protection & macros
 
You have to turn off protection, run code, then turn it back on all through
code. Just record a macro of you protecting the sheet, then unprotect it.
Look at the code that is created in the module and you will see what it takes
to unprotect. Put the unprotect at the beginning and the protect at the end.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Neil Pearce" wrote:

Dear all,

I would like to protect my spreadsheet so that others might use it. However
when I do so the macros in the workbook do not run. I may select the button
that they are attached to but the marco itself doesn't run.

Which settings do I change to alter this situation?


Thanks in advance,

Neil


Dave Peterson

Excel protection & macros
 
Do the macros not even start or do they start and fail?

If they don't start, make sure your users are enabling macros when they open
your workbook.

If they start and then fail, then you may be trying to do stuff that isn't
allowed on a protected worksheet.

If that's the case, you can unprotect the worksheet at the top of your macro, do
the work and then reprotect the worksheet right before your macro ends.

Neil Pearce wrote:

Dear all,

I would like to protect my spreadsheet so that others might use it. However
when I do so the macros in the workbook do not run. I may select the button
that they are attached to but the marco itself doesn't run.

Which settings do I change to alter this situation?

Thanks in advance,

Neil


--

Dave Peterson

Neil Pearce

Excel protection & macros
 
That has worked well John, thank-you. However this doesn't enable me to set
a password within the workbook thereby others may still alter the
spreadsheet.

Is there a way to enable Macros to run if a set a password is imputted when
protection the workbook?

"John Bundy" wrote:

You have to turn off protection, run code, then turn it back on all through
code. Just record a macro of you protecting the sheet, then unprotect it.
Look at the code that is created in the module and you will see what it takes
to unprotect. Put the unprotect at the beginning and the protect at the end.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Neil Pearce" wrote:

Dear all,

I would like to protect my spreadsheet so that others might use it. However
when I do so the macros in the workbook do not run. I may select the button
that they are attached to but the marco itself doesn't run.

Which settings do I change to alter this situation?


Thanks in advance,

Neil


Neil Pearce

Excel protection & macros
 
That has worked well Dave, thank-you. However this doesn't enable me to set
a password within the workbook thereby others may still alter the
spreadsheet. Is there a list somewhere of what is allowed and not allowed
when the spreadsheet is protected?

Is there a way to enable Macros to run if a set a password is inputted when
protection the workbook?


"Dave Peterson" wrote:

Do the macros not even start or do they start and fail?

If they don't start, make sure your users are enabling macros when they open
your workbook.

If they start and then fail, then you may be trying to do stuff that isn't
allowed on a protected worksheet.

If that's the case, you can unprotect the worksheet at the top of your macro, do
the work and then reprotect the worksheet right before your macro ends.

Neil Pearce wrote:

Dear all,

I would like to protect my spreadsheet so that others might use it. However
when I do so the macros in the workbook do not run. I may select the button
that they are attached to but the marco itself doesn't run.

Which settings do I change to alter this situation?

Thanks in advance,

Neil


--

Dave Peterson


Dave Peterson

Excel protection & macros
 
I don't understand.

If you have a worksheet protected, then you know the password. And I would
guess that you have both locked and unlocked cells in that worksheet.

The users should be able to change the unlocked cells on that protected sheet
with no problems.



Neil Pearce wrote:

That has worked well Dave, thank-you. However this doesn't enable me to set
a password within the workbook thereby others may still alter the
spreadsheet. Is there a list somewhere of what is allowed and not allowed
when the spreadsheet is protected?

Is there a way to enable Macros to run if a set a password is inputted when
protection the workbook?

"Dave Peterson" wrote:

Do the macros not even start or do they start and fail?

If they don't start, make sure your users are enabling macros when they open
your workbook.

If they start and then fail, then you may be trying to do stuff that isn't
allowed on a protected worksheet.

If that's the case, you can unprotect the worksheet at the top of your macro, do
the work and then reprotect the worksheet right before your macro ends.

Neil Pearce wrote:

Dear all,

I would like to protect my spreadsheet so that others might use it. However
when I do so the macros in the workbook do not run. I may select the button
that they are attached to but the marco itself doesn't run.

Which settings do I change to alter this situation?

Thanks in advance,

Neil


--

Dave Peterson


--

Dave Peterson

Gord Dibben

Excel protection & macros
 
Neil

Maybe this..............?

Sub dothings()
ActiveSheet.Unprotect Password:="justme"
'your macro code to do things
ActiveSheet.Protect Password:="justme"
End Sub


Gord Dibben MS Excel MVP

On Wed, 13 Feb 2008 08:16:05 -0800, Neil Pearce
wrote:

That has worked well Dave, thank-you. However this doesn't enable me to set
a password within the workbook thereby others may still alter the
spreadsheet. Is there a list somewhere of what is allowed and not allowed
when the spreadsheet is protected?

Is there a way to enable Macros to run if a set a password is inputted when
protection the workbook?


"Dave Peterson" wrote:

Do the macros not even start or do they start and fail?

If they don't start, make sure your users are enabling macros when they open
your workbook.

If they start and then fail, then you may be trying to do stuff that isn't
allowed on a protected worksheet.

If that's the case, you can unprotect the worksheet at the top of your macro, do
the work and then reprotect the worksheet right before your macro ends.

Neil Pearce wrote:

Dear all,

I would like to protect my spreadsheet so that others might use it. However
when I do so the macros in the workbook do not run. I may select the button
that they are attached to but the marco itself doesn't run.

Which settings do I change to alter this situation?

Thanks in advance,

Neil


--

Dave Peterson



Neil Pearce

Excel protection & macros
 
Perfect Gord, thank-you.

"Gord Dibben" wrote:

Neil

Maybe this..............?

Sub dothings()
ActiveSheet.Unprotect Password:="justme"
'your macro code to do things
ActiveSheet.Protect Password:="justme"
End Sub


Gord Dibben MS Excel MVP

On Wed, 13 Feb 2008 08:16:05 -0800, Neil Pearce
wrote:

That has worked well Dave, thank-you. However this doesn't enable me to set
a password within the workbook thereby others may still alter the
spreadsheet. Is there a list somewhere of what is allowed and not allowed
when the spreadsheet is protected?

Is there a way to enable Macros to run if a set a password is inputted when
protection the workbook?


"Dave Peterson" wrote:

Do the macros not even start or do they start and fail?

If they don't start, make sure your users are enabling macros when they open
your workbook.

If they start and then fail, then you may be trying to do stuff that isn't
allowed on a protected worksheet.

If that's the case, you can unprotect the worksheet at the top of your macro, do
the work and then reprotect the worksheet right before your macro ends.

Neil Pearce wrote:

Dear all,

I would like to protect my spreadsheet so that others might use it. However
when I do so the macros in the workbook do not run. I may select the button
that they are attached to but the marco itself doesn't run.

Which settings do I change to alter this situation?

Thanks in advance,

Neil

--

Dave Peterson





All times are GMT +1. The time now is 03:10 AM.

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