PC Review


Reply
Thread Tools Rate Thread

Applying Protection Perameters With VBA Code

 
 
scott@utahpavers.com
Guest
Posts: n/a
 
      30th Jan 2007
I am trying to have the macro unprotect the sheet, perform the
function, then re-protect the sheet. I just need to know how to go
about entering the code for the protection options I want it to
apply. The only ones I want to apply are "Select Unlocked Cells" and
"Edit Objects". Could you give me any info on how I need to enter
that? Here is the macro I am currently using:





Worksheets("Surface #1").Unprotect "password"

Rows("14:20").Select

Selection.EntireRow.Hidden = False

Range("H15").Select

Worksheets("Surface #1").Protect "password"





I figured it should look something like this but it didn't work:





Worksheets("Surface #1").Unprotect "password"

Rows("14:20").Select

Selection.EntireRow.Hidden = False

Range("H15").Select

Worksheets("Surface #1").Protect "password",
SelectUlockedCells:=True, EditObjects:=True





Please reply with any suggestions you might have!

 
Reply With Quote
 
 
 
 
Alan
Guest
Posts: n/a
 
      30th Jan 2007
Hi Scott,

Locked cells are only locked under password protection. Once protection is
removed all cells "protection options" are removed.

Sheets("Surface #1").UnProtect Password:= "password"
Range("H15").Select
Rows("14:20").EntireRow.Hidden = False
Sheets("Surface #1").Protect Password:= "password"


Alan


"The only dumb question is a question left unasked."


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am trying to have the macro unprotect the sheet, perform the
> function, then re-protect the sheet. I just need to know how to go
> about entering the code for the protection options I want it to
> apply. The only ones I want to apply are "Select Unlocked Cells" and
> "Edit Objects". Could you give me any info on how I need to enter
> that? Here is the macro I am currently using:
>
>
>
>
>
> Worksheets("Surface #1").Unprotect "password"
>
> Rows("14:20").Select
>
> Selection.EntireRow.Hidden = False
>
> Range("H15").Select
>
> Worksheets("Surface #1").Protect "password"
>
>
>
>
>
> I figured it should look something like this but it didn't work:
>
>
>
>
>
> Worksheets("Surface #1").Unprotect "password"
>
> Rows("14:20").Select
>
> Selection.EntireRow.Hidden = False
>
> Range("H15").Select
>
> Worksheets("Surface #1").Protect "password",
> SelectUlockedCells:=True, EditObjects:=True
>
>
>
>
>
> Please reply with any suggestions you might have!
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
applying worksbook protection via a Macro =?Utf-8?B?RGF2aWQgUw==?= Microsoft Excel Programming 2 19th Mar 2007 09:37 PM
Applying Protection To Multiple Sheets Mhz Microsoft Excel New Users 4 6th Jul 2006 01:22 PM
Turning System File Protection On After Applying Service Packs CHANGE USERNAME TO westes Microsoft Windows 2000 Security 1 25th Oct 2004 02:06 PM
Re: Removing and Applying protection in VBA steve Microsoft Excel Programming 2 20th Oct 2003 09:14 PM
Applying protection to an Excel Expense Report Donna Bennett Microsoft Excel Programming 1 18th Oct 2003 03:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:19 PM.