Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 17
Default protection and macros

I need to protect a worksheet, but users need to be able
to click a button that runs a macro (which sorts the
protected information). How can I protect it, while
still allowing the macro button to work? Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default protection and macros

Add a couple of lines to your macro:

worksheets("sheet1").unprotect password:="hi"
'your sort code
worksheets("sheet1").protect password:="hi"

Sam wrote:

I need to protect a worksheet, but users need to be able
to click a button that runs a macro (which sorts the
protected information). How can I protect it, while
still allowing the macro button to work? Thanks!


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protection and macros

Hi Sam,
You need your code to:
1.Unprotect the sheet
.Unprotect(Password)
2. Run the button process
3. Re-protect the sheet
.Protect Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly

Regards,
Sébastien
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default protection and macros

Hi Sam,

You need your code to:
1.Unprotect the sheet using the worksheet method:
.Unprotect(Password)
2. Run the button process code
3. Re-protect the sheet using the sheet method
.Protect Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly

Regards,
Sébastien
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
Excel protection & macros Neil Pearce Excel Discussion (Misc queries) 7 February 14th 08 02:20 PM
Macros/Protection/Pivot Tables...HELP KDG Excel Discussion (Misc queries) 0 October 19th 06 08:45 PM
how to hide a list of macros without password protection Padam Excel Worksheet Functions 1 July 12th 06 11:30 AM
macros and protection SYBS Excel Worksheet Functions 9 May 24th 06 06:52 PM
Protection & Macros Catherine[_5_] Excel Programming 6 June 12th 04 12:24 PM


All times are GMT +1. The time now is 06:09 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"