+ Reply to Thread
Results 1 to 2 of 2

Sorting Protected Worksheet

  1. #1
    Registered User
    Join Date
    07-16-2005
    Posts
    1

    Sorting Protected Worksheet

    Is there a way to create a macro that sorts a protected worksheet where some of the cells are locked without putting the protection password in the macro?

    I've created a workbook that is used for keeping track of baseball stats. On one of the worksheets (that is protected) I have an area where the user can enter the stats for there players but the player name and a few other columns are locked (un-editable). I'm trying to create a macro to sort the stats based on the batting average, but in order to keep everything lined up correctly I need to sort the unlocked cells along with four columns of locked cells. I can't figure out if that possible.

    Like I said, I got it to work by adding code to unprotect the sheet before sorting, then protecting it again after the sort, but I had to put the protection password in the code to do it. That defeats the purpose of password protecting the sheet in the first place because any can get the password by browsing the code.

    Anyone have any ideas?

    Thanks.

  2. #2
    Norman Jones
    Guest

    Re: Sorting Protected Worksheet

    Hi Vonner,

    >That defeats the
    > purpose of password protecting the sheet in the first place because any
    > can get the password by browsing the code.


    Try locking and protecting the project:

    Right- click the project in the VBE , select VBA Project Properties,
    Protection Tab...

    This will hide your code from casual users. Excel does not, however, provide
    a secure environment and a determined user will readily be able to gain
    access to your code. Such determination need not exceed suitable Google
    search.

    ---
    Regards,
    Norman



    "Vonner" <Vonner.1s9mub_1121522701.7973@excelforum-nospam.com> wrote in
    message news:Vonner.1s9mub_1121522701.7973@excelforum-nospam.com...
    >
    > Is there a way to create a macro that sorts a protected worksheet where
    > some of the cells are locked without putting the protection password in
    > the macro?
    >
    > I've created a workbook that is used for keeping track of baseball
    > stats. On one of the worksheets (that is protected) I have an area
    > where the user can enter the stats for there players but the player
    > name and a few other columns are locked (un-editable). I'm trying to
    > create a macro to sort the stats based on the batting average, but in
    > order to keep everything lined up correctly I need to sort the unlocked
    > cells along with four columns of locked cells. I can't figure out if
    > that possible.
    >
    > Like I said, I got it to work by adding code to unprotect the sheet
    > before sorting, then protecting it again after the sort, but I had to
    > put the protection password in the code to do it. That defeats the
    > purpose of password protecting the sheet in the first place because any
    > can get the password by browsing the code.
    >
    > Anyone have any ideas?
    >
    > Thanks.
    >
    >
    > --
    > Vonner
    > ------------------------------------------------------------------------
    > Vonner's Profile:
    > http://www.excelforum.com/member.php...o&userid=25283
    > View this thread: http://www.excelforum.com/showthread...hreadid=387735
    >




+ 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