Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default VBA to Protect Worksheet

I accidentally used the following code in some VBA to protect my worksheet:
ActiveSheet.Protect Password = "grencr" (I excluded the colon)

I should have used: ActiveSheet.Unprotect Password:="grencr".

The code worked and my worksheet is now protected, but I'm not sure what the
password is. It is no longer grencr. Any idea what my password was set to
since I didn't include the : in the code?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VBA to Protect Worksheet

Try FALSE (all caps).

If that doesn't work, you could break the password...
(Visit JE McGimpsey's site: http://mcgimpsey.com/excel/removepwords.html)

Alex wrote:

I accidentally used the following code in some VBA to protect my worksheet:
ActiveSheet.Protect Password = "grencr" (I excluded the colon)

I should have used: ActiveSheet.Unprotect Password:="grencr".

The code worked and my worksheet is now protected, but I'm not sure what the
password is. It is no longer grencr. Any idea what my password was set to
since I didn't include the : in the code?

Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default VBA to Protect Worksheet

YES!!!! Thanks so much Dave - I've trying everything.

"Dave Peterson" wrote:

Try FALSE (all caps).

If that doesn't work, you could break the password...
(Visit JE McGimpsey's site: http://mcgimpsey.com/excel/removepwords.html)

Alex wrote:

I accidentally used the following code in some VBA to protect my worksheet:
ActiveSheet.Protect Password = "grencr" (I excluded the colon)

I should have used: ActiveSheet.Unprotect Password:="grencr".

The code worked and my worksheet is now protected, but I'm not sure what the
password is. It is no longer grencr. Any idea what my password was set to
since I didn't include the : in the code?

Thanks


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VBA to Protect Worksheet

You may have been saved a little trouble by telling excel that you want to only
use variables that you declare.

If you had:
Option Explicit

At the top of your module, then every variable would have to have a:
dim xxxx as yyyyy
statement.

And Password may have been flagged as an undeclared variable.

It may seem like extra work to have to declare all your variables, but it can
stop the kind of error you had and even these hard to see ones:

Row1 = Rowl + 1

(one is row-one and one is row-ell)

And you get all the nice intellisense on top of this.

dim wks as worksheet
type
wks.
As soon as you hit that dot (.), you'll get a list off all the things that can
come next.



Alex wrote:

YES!!!! Thanks so much Dave - I've trying everything.

"Dave Peterson" wrote:

Try FALSE (all caps).

If that doesn't work, you could break the password...
(Visit JE McGimpsey's site: http://mcgimpsey.com/excel/removepwords.html)

Alex wrote:

I accidentally used the following code in some VBA to protect my worksheet:
ActiveSheet.Protect Password = "grencr" (I excluded the colon)

I should have used: ActiveSheet.Unprotect Password:="grencr".

The code worked and my worksheet is now protected, but I'm not sure what the
password is. It is no longer grencr. Any idea what my password was set to
since I didn't include the : in the code?

Thanks


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can protect worksheet then workbook but not Protect and Share in code [email protected] Excel Programming 7 January 16th 17 07:01 AM
protect worksheet Selen Excel Discussion (Misc queries) 3 April 29th 10 03:56 PM
worksheet protect jnu Excel Worksheet Functions 2 March 23rd 06 01:35 PM
How to protect a worksheet from being copied to another worksheet SurvivorIT Excel Discussion (Misc queries) 3 August 31st 05 01:53 PM
Protect worksheet madcat[_9_] Excel Programming 1 August 30th 04 02:46 AM


All times are GMT +1. The time now is 09:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"