Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
earl
 
Posts: n/a
Default use macro button to run macro in protected sheet

I have a list of items that i want to sort. I am using a button to run a
macro to do this. I need to have this sheet password protected. When I
protect it and run the macro, it ask for a password. I will be sending this
to other people and want this macro to run without having to enter a password
but still have the sheet protected as it contains prices.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.misc
dominicb
 
Posts: n/a
Default use macro button to run macro in protected sheet


Good evening earl

Use:

ActiveSheet.Unprotect Password:="pass"

to unprotect the sheet, assuming the password to be "pass". You can
now run your sorting macro. Now use this line:

ActiveSheet.Protect Password:="pass"

to reprotect the sheet, setting the password back as "pass".

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=516711

  #3   Report Post  
Posted to microsoft.public.excel.misc
earl
 
Posts: n/a
Default use macro button to run macro in protected sheet

Thanks dominicb
this solved my problem.


"dominicb" wrote:


Good evening earl

Use:

ActiveSheet.Unprotect Password:="pass"

to unprotect the sheet, assuming the password to be "pass". You can
now run your sorting macro. Now use this line:

ActiveSheet.Protect Password:="pass"

to reprotect the sheet, setting the password back as "pass".

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=516711


  #4   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin
 
Posts: n/a
Default use macro button to run macro in protected sheet

This is another option
Old posting from Dave Peterson
*************************

xl2002 added some options to allow filtering and sorting of a protected
worksheet.

Until then, I think you'd have to give the user a way to sort the data--maybe a
macro that would unprotect the sheet, sort the data and then reprotect the
sheet.

But for the autofilter, you can protect the worksheet in code (if the autofilter
is already applied):

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.EnableAutoFilter = True
End With
End Sub

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook.)

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


"earl" wrote in message ...
I have a list of items that i want to sort. I am using a button to run a
macro to do this. I need to have this sheet password protected. When I
protect it and run the macro, it ask for a password. I will be sending this
to other people and want this macro to run without having to enter a password
but still have the sheet protected as it contains prices.

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
apply a macro to all sheets except for a certain sheet minrufeng Excel Discussion (Misc queries) 4 February 22nd 06 02:53 PM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
Change caption on a macro button gbeard Excel Worksheet Functions 3 April 21st 05 01:43 PM
Macro Errs when sheet is protected Skankles Excel Worksheet Functions 1 February 10th 05 06:44 PM
how to hide rows in a protected sheet Prakash Excel Worksheet Functions 7 January 18th 05 02:42 PM


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