Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro Code Issue

So how exactly then do I lock down and protect cells from being edited on
multiple spreadsheets?

"Gord Dibben" wrote:

The password is provided in the macros so won't get asked for it.


Gord Dibben MS Excel MVP

On Mon, 1 Jun 2009 13:31:01 -0700, uncbluegal
wrote:

I've entered the following code within my excel document:

Sub UnlockAllSheets()
Const thePassword = "filepassword"
Dim anySheet As Worksheet
For Each anySheet In ThisWorkbook.Worksheets
anySheet.Unprotect Password:=thePassword
Next
End Sub

Sub LockAllSheets()
Const thePassword = "filepassword"
Dim anySheet As Worksheet
For Each anySheet In ThisWorkbook.Worksheets
anySheet.Protect Password:=thePassword
Next

End Sub


I have many locked and unlocked cells within this 13 worsheet workbook. I
can easily run either the unlock or lock macro - but - I'm never asked for
the password when I run either macro. Why is this?



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
Need assistance with code issue?? Mekinnik Excel Programming 1 December 13th 07 07:25 PM
Code issue Tom Excel Programming 4 May 29th 07 10:31 AM
Reliability issue with some code Dean[_9_] Excel Programming 0 March 25th 06 01:32 PM
Autofit code Issue Joe Excel Programming 0 December 20th 05 04:12 PM
VBA Code issue scrabtree23[_3_] Excel Programming 2 December 4th 04 04:26 PM


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

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

About Us

"It's about Microsoft Excel"