+ Reply to Thread
Results 1 to 6 of 6

VBA Help with Selective Sorting

  1. #1
    Forum Contributor
    Join Date
    01-29-2008
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    237

    VBA Help with Selective Sorting

    Please find attached a example spreadsheet of what im trying todo

    There are two tabs, one showing the before sort and the other showing what it should look like after the sort.

    The sort command will be a macro within a custom menu on the tool bar, which is not shown on the example.

    What i need is a sort function that will sort the whole page first by column D then by column E.

    But what i need is for the sort to exclude the blank rows, and rows which are Breaks, Starts and ends, there is also a section for route checks which also need to be excluded.

    So the only data that needs to be sorted is the data that has a ref number ( column A) but it need to look like the after sort page when done. As you will see the data stays within the dates but sorted.

    Hope this explains every thing

    if not i can provide more information

    G

    Oh columns A, I and J are locked and the worksheet is protected, but not this example.
    Attached Files Attached Files
    Last edited by drgogo; 04-30-2009 at 10:16 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA Help with Selective Sorting

    Give this macro a run on your protected worksheet:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    01-29-2008
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    237

    Re: VBA Help with Selective Sorting

    It working..

    Thanks, I take it that this will do up to the maxium rows, the sheet is set at 3000 rows at the moment, but over th ecoming years could be increased. So i take it that this code will still cover that.

    again thank you very much, I'll get my users to test it to see if it is fool proof

    Thanks for your help and time

    Will get back to you once i have had a full test

    G

  4. #4
    Forum Contributor
    Join Date
    01-29-2008
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    237

    Re: VBA Help with Selective Sorting

    been giving the macro a serious test and its working well

    Only problem is when i first run the macro a Unprotect Password msg box appears asking for a password.

    Whats the editing required to stop this msg box from appearing, but still keeping the sheet protected and locked???

    G

  5. #5
    Registered User
    Join Date
    05-12-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: VBA Help with Selective Sorting

    =Stdev(if(A1:g400>34 and a1:g400<54))

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA Help with Selective Sorting

    I would have thought you would want to keep your password OUT of the macro and entering it once the first time you use the macro would be preferable. But if not, add the password in like so:
    Please Login or Register  to view this content.

+ 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