macro on protected sheet

Homer J

New Member
Joined
Sep 20, 2003
Messages
23
I have a simple macro doing a text to columns function, but it won't run when the sheets are protected. Is this the way it's supposed to be? Is there a way I can change it? There's 2 worksheets using the same macro.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Yes, that's the way it's supposed to be.
Seeing the code would be helpful, but without it, maybe this will still help.
You could either specify the sheets by name, or simply begin your code with:
Code:
ActiveSheet.Unprotect "Your password here"
and end the routine with:
Code:
ActiveSheet.Protect "Your password here"
You can leave out the "Your password here" if you aren't going to use one.

Hope it helps,
Dan

Edit: This will work if the macro is only performing on one sheet at a time. (the active sheet). If it's to work on both sheets at the same time you'll need to name them in the code.
 
Upvote 0
basicly yes, this is how it works, anyhow there is a way around it

i.e

you have this macro working on sheet1

so in the macro add:

sheet1.unprotect

macro code

sheet1.protect


now.. if you have a password, you will need to use sheet1.protect password = "mypassword"
and same for unprotect

hope this helps
 
Upvote 0
any idea on what' going on with this:

I password protect my worksheet.

I use the code above to uprotect, run macro, and protect again, including the password. Now when I manually go to unprotect the worksheet, it tells me the password is incorrect. I have done this with both with and without the Password = "password" -- that is

unprotect password = "password"
macro
protect password = "password"

and

unprotect "password"
macro
protect "password"
 
Upvote 0
Those two things you've tried aren't going to make a difference. If you follow the .Protect bit with something in quotes, the "Password=" bit is implied. (In other words, they're the same, with or without.)

What I would suggest is go into the code and look closely at the password you wrote in the code and make sure when you're doing it manually you're using the correct spelling, text case etc.

Post back for more ideas if that don't work, but that's the most likely case.

Hope it helps,
Dan
 
Upvote 0
Hi there,
I faced the same problem as did m_woychick, when using this Code. And I am positive that the password that I entered into the Code and the one that I used to manually unprotect the sheet is the same.

How to solve this problem? Else, the worksheets are forever locked!

*sigh*

Thanks in advance!
 
Upvote 0
I found a macro on this site to remove a password. I found that the code would work as long as I didn't include the password = part. I think the way the example reads in this posting it is not consistent--when you remove protection and then reset it. Anyway, that's what I did and I'm using it now without problems.

here's a couple of ways to break the password so you can try the macro again:
http://www.mrexcel.com/board2/viewtopic.php?t=92725&highlight=password[/url]
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,923
Members
448,533
Latest member
thietbibeboiwasaco

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