Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 275
Default Protecting a worksheet

Hi all

I have a worksheet that contains aprox 8 buttons that each run a macro to
complete certain tasks from displaying userforms to moving to another
worksheet.

Rather than adding code into each macro, is there a way to protect the
worksheet, unprotect whilst any macro is run then protect it again once the
macro is complete?

thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Protecting a worksheet

You will have to add code to each button but you can make the code very short
by addin two procedures to do the protection and unprotection. Call the
unprotectall macro at the start and the protectall at the end of each command
button procedure...

sub UnProtectAll
dim wks as worksheet

for each wks in thisworkbook.worksheets
wks.unprotect Password:="Tada"
next wks
End sub

sub ProtectAll
dim wks as worksheet

for each wks in thisworkbook.worksheets
wks.protect Password:="Tada"
next wks
End sub

--
HTH...

Jim Thomlinson


"Anthony" wrote:

Hi all

I have a worksheet that contains aprox 8 buttons that each run a macro to
complete certain tasks from displaying userforms to moving to another
worksheet.

Rather than adding code into each macro, is there a way to protect the
worksheet, unprotect whilst any macro is run then protect it again once the
macro is complete?

thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Protecting a worksheet

try to find Protect Method/ UserInterfaceOnly in help
mcg


Użytkownik "Anthony" napisał w
wiadomo¶ci ...
Hi all

I have a worksheet that contains aprox 8 buttons that each run a macro to
complete certain tasks from displaying userforms to moving to another
worksheet.

Rather than adding code into each macro, is there a way to protect the
worksheet, unprotect whilst any macro is run then protect it again once
the
macro is complete?

thanks



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
Protecting worksheet John in Wembley Excel Programming 1 January 28th 08 09:41 PM
Protecting a worksheet sherobot Excel Programming 5 June 8th 07 11:52 PM
Un-Protecting a Worksheet Lauren Giles Excel Discussion (Misc queries) 2 February 7th 07 11:46 PM
protecting the worksheet Jezebel Excel Worksheet Functions 1 December 4th 05 08:15 AM


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

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"