+ Reply to Thread
Results 1 to 8 of 8

Sort Macro

  1. #1
    Registered User
    Join Date
    05-17-2013
    Location
    New Hampshire
    MS-Off Ver
    Excel 2010
    Posts
    84

    Sort Macro

    I have a calender that I use for each month. There is one tab or sheet for each month. In that calendar I have a flight schedule for each day. I have to sort the time column for each day so I recorded this macro:

    Please Login or Register  to view this content.
    This macro then calls on AutoSort2 and continues to sort the time column. My problem is that I want this macro to work on all sheets, but ONLY on the active sheet. As I said, I will have 12 tabs, one for each month and they will be named: 2014-01, 2014-02, 2014-03.........blah, blah...!!! One thing I did't mention is that the time column uses times that are simply text numbers: 100, 200, 300.....1445, 1650, 2300. If you add these times in the time colum, out of order and run the code it will sort them times as well as whole square so the flights still match. What do I need to do to make this work for each sheet.

    Moderators note: code tags added for you - this time
    Attached Files Attached Files
    Last edited by FDibbins; 06-29-2013 at 05:22 PM. Reason: code tags added

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Sort Macro

    Will the ranges be the same in all sheets?

  3. #3
    Registered User
    Join Date
    05-17-2013
    Location
    New Hampshire
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Sort Macro

    yes every sheet is the same,it is a 7 x 6 grid Sunday - Saturday, the dates will change but....b232 is always b232 on every sheet....that was just an example! I did upload the actual sheet with code embedded.
    Last edited by RandyD123; 06-29-2013 at 09:18 PM. Reason: added more info

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655
    Everywhere you have Activeworkbook.sheets(sheetxyz) will have to be changed to activeworksheet. I'd change it for you but I'm replying from my phone.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  5. #5
    Registered User
    Join Date
    05-17-2013
    Location
    New Hampshire
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Sort Macro

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-17-2013
    Location
    New Hampshire
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Sort Macro

    I must have done it wrong, I tried it but I got a "required object" error!!

  7. #7
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort Macro

    Randy,
    ActiveSheet, not ActiveWorksheets

  8. #8
    Registered User
    Join Date
    05-17-2013
    Location
    New Hampshire
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Sort Macro

    Thank you, it worked!!

+ 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