+ Reply to Thread
Results 1 to 4 of 4

use macro button to run macro in protected sheet

Hybrid View

Guest use macro button to run macro... 02-26-2006, 05:25 PM
dominicb Good evening earl Use: ... 02-26-2006, 05:40 PM
Guest Re: use macro button to run... 02-26-2006, 06:15 PM
Guest Re: use macro button to run... 02-26-2006, 06:25 PM
  1. #1
    earl
    Guest

    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. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    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

  3. #3
    earl
    Guest

    Re: 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. #4
    Ron de Bruin
    Guest

    Re: 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" <earl@discussions.microsoft.com> wrote in message news:CEDCD6F1-AD9B-489D-B4B1-651BCA132395@microsoft.com...
    >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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1