Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Applying Protection Perameters With VBA Code

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!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Applying Protection Perameters With VBA Code

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."


wrote in message
oups.com...
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
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
Applying Protection To Multiple Sheets Mhz New Users to Excel 4 July 6th 06 01:22 PM
Drag&Drop / Cut &Paste default perameters fitzgerak Excel Discussion (Misc queries) 0 March 21st 05 11:09 PM
Worksheet Changes and applying code Nigel Bennett Excel Worksheet Functions 1 March 13th 05 06:49 PM
Removing and Applying protection in VBA steve Excel Programming 2 October 20th 03 09:14 PM
Applying protection to an Excel Expense Report Donna Bennett Excel Programming 1 October 18th 03 03:33 PM


All times are GMT +1. The time now is 08:25 AM.

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"