+ Reply to Thread
Results 1 to 7 of 7

VBA Help to Sort Worksheets

  1. #1
    Registered User
    Join Date
    02-14-2013
    Location
    wales
    MS-Off Ver
    Excel 2010
    Posts
    64

    VBA Help to Sort Worksheets

    I have a workbook that I a having difficulty in sorting the worksheets. I want to sort the sheets starting after sheet 3 which is called "Master". I had it working where it sorted it first time that I ran the macro but the when a new sheet was inserted after the Master sheet then the sort all went wrong.
    Here's the current code and I have attached an example workbook. Would appreciate some help
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: VBA Help to Sort Worksheets

    Hi,

    Try this code which I had on hand (on my PC)
    Adjust as needed...
    It will sort from sheet 4 to the end...

    Please Login or Register  to view this content.
    Regards,
    Rudi

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: VBA Help to Sort Worksheets

    You could use this macro.
    The LT function tests if the sheet name is numeric, to avoid a purely alphabetic sort where "12" < "2"
    Please Login or Register  to view this content.
    Last edited by mikerickson; 07-06-2014 at 11:59 AM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: VBA Help to Sort Worksheets

    double post

  5. #5
    Registered User
    Join Date
    02-14-2013
    Location
    wales
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: VBA Help to Sort Worksheets

    Great job thanks you. I have got my original code to work by replacing the "Ucase" with "Val" and this worked. How would your code look hard coded to descending rather than having the question box

    many thanks Mark

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: VBA Help to Sort Worksheets

    Just set Descending to True.

    Or omit the Descending variable all together and change this line

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-14-2013
    Location
    wales
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: VBA Help to Sort Worksheets

    Thanks All

+ 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. sort worksheets alphabetically and keep the data in the worksheets
    By Cynthia Woods in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-15-2013, 12:38 PM
  2. Sort all Worksheets
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2010, 09:41 AM
  3. [SOLVED] How do I sort Worksheets by name?
    By M Skabialka in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 04-07-2005, 02:06 PM
  4. [SOLVED] Sort Worksheets
    By mate in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-24-2005, 07:06 AM
  5. [SOLVED] Sorting Worksheets-is it possible to sort worksheets alphabetically?
    By pepperds in forum Excel General
    Replies: 1
    Last Post: 03-10-2005, 05:06 PM

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