+ Reply to Thread
Results 1 to 8 of 8

Auto sort with locked worksheets

  1. #1
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Auto sort with locked worksheets

    Hi All,

    I know there many posts about this topic already, but I also know nothing about VBA code. I was able to "Frankenstein" my sort code from posts I had found online, but I'd like to be able to now lock my worksheets but still run this code. There is only one worksheet that is sorting, so that should be the only worksheet that will need to be unlocked and re-locked. There are a few unlocked cells, and I would like the entire sheet to unlock, sort, then re-lock after data is entered in one of those cells. Here is the code that I have. I'm hoping that my request is a simple one and I apologize for my ignorance.

    Please Login or Register  to view this content.

    Thanks!

  2. #2
    Registered User
    Join Date
    11-05-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Auto sort with locked worksheets

    When locking the sheet, you could just tick off set sort box, this will allow the user to sort, while the sheet is locked? this could be easier

  3. #3
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Auto sort with locked worksheets

    I would think that would work but I still get the run-time 1004 error. When I click debug it highlights:

    Please Login or Register  to view this content.
    Any thoughts? The sort function works fine the sheet is unprotected.
    Last edited by smatchymo; 09-14-2013 at 03:30 PM. Reason: added that the sort works fine when unprotected

  4. #4
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Auto sort with locked worksheets

    I thought maybe I should add some more background about my workbook. The unlocked cells are for results and when those results are entered the data changes in the four tables. The tables pull data from other locked worksheets where I haven't checked the sort box, but no data is sorted on those worksheets.

  5. #5
    Registered User
    Join Date
    11-05-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Auto sort with locked worksheets

    If theres no code on the protected sheet, you should just be able to add the following to your code:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Auto sort with locked worksheets

    That gives me a run-time error '9': Subscript out of range.

    When clicking on the debugger it highlights "Sheets("test").Activate" Was I supposed to put the name of the worksheet where "test" was?

    Oh, and I only have code on Sheet1. "Worksheet" is selected in the first dropdown box, and "change" in the second. Not sure if that helps.
    Last edited by smatchymo; 09-14-2013 at 04:31 PM.

  7. #7
    Registered User
    Join Date
    11-05-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Auto sort with locked worksheets

    Yes.. Subscript out of range is simply that "test" is not a sheets in your workbook



    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-30-2012
    Location
    Madison, WI
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Auto sort with locked worksheets

    Thanks! And after a quick search online I was able to add code for the password so that wouldn't need to be entered.

    Please Login or Register  to view this content.
    Now I just need to find how to mark this "solved" .

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Auto Sort, Auto Lock, Auto Date & Time Stamp
    By suehatesyou in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2010, 02:57 PM
  2. Sort between Excel Sheets with locked cells
    By UMOP in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-19-2010, 01:52 AM
  3. [SOLVED] How do I sort locked cells in Excel?
    By Cathy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-09-2006, 11:54 AM
  4. Auto Fill with some references locked
    By d99alu@efd.lth.se in forum Excel General
    Replies: 3
    Last Post: 02-28-2006, 01:55 PM
  5. Help:macro to auto sort data to different worksheets...
    By 2nd Time Around in forum Excel General
    Replies: 2
    Last Post: 08-06-2005, 08:05 AM

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