+ Reply to Thread
Results 1 to 12 of 12

need to sort three sheets differently in same workbook

  1. #1
    Registered User
    Join Date
    10-23-2017
    Location
    North Carolina
    MS-Off Ver
    Office 2010
    Posts
    13

    need to sort three sheets differently in same workbook

    I have a workbook with the 1st sheet is a main calendar, the two sheets after are the same calendar, but sorted different.
    The first (main) sheet is sorted by date, time, event name. The second sheet should be sorted by event name, date, time.
    The third sheet should be sorted by shift, date, event name.
    I have a macro running that copies the data from the first sheet to the two consecutive sheets, but I need to find out how to automatically sort the sheets when I enter the data the first time.
    I am fairly new and still learning VBA. I would ultimately have a button in the toolbar that will sort on demand.
    Please help.

    Here is a sample so you can see the data (in general) I'm working with.
    sample of calendar.jpg

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: need to sort three sheets differently in same workbook

    Do you actually need 3 copies of the same sheet - or is this just to give yu the different sorted views?

    You could have a 3 buttons to click on a single sheet
    - sort1 = date, time, event name
    - sort2 = event name, date, time
    - sort3 = shift, date, event name

    Avoids risk of the 3 sheets going out of sync, reduces filesize and VBA simplified
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Registered User
    Join Date
    10-23-2017
    Location
    North Carolina
    MS-Off Ver
    Office 2010
    Posts
    13

    Re: need to sort three sheets differently in same workbook

    Quote Originally Posted by kev_ View Post
    Do you actually need 3 copies of the same sheet - or is this just to give yu the different sorted views?

    You could have a 3 buttons to click on a single sheet
    - sort1 = date, time, event name
    - sort2 = event name, date, time
    - sort3 = shift, date, event name

    Avoids risk of the 3 sheets going out of sync, reduces filesize and VBA simplified
    Would I be able to have the three sort buttons on the main sheets toolbar?

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: need to sort three sheets differently in same workbook

    To add a macro to a toolbar see this link
    - see if you can get it to work using single one line VBA (simple Message Box perhaps)
    - is there any reason why that will not work for you?

    This link may be helpful too

    PS - do not quote the whole of the previous post
    - clutters everything up
    - click on Reply
    - use quote selectively if answering a particular point or if replying to a post further up the thread
    Last edited by kev_; 10-23-2017 at 10:54 AM.

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: need to sort three sheets differently in same workbook

    To help you create the VBA, it would be helpful to have a sample workbook containing typical data including all columns
    - I do not wnat to recreate everything when it is already available


    To attach a workbook
    - make the details sufficiently anonymous
    - click on GOAdvanced
    - look below for ManageAttachments
    - follow screen instructions
    Last edited by kev_; 10-23-2017 at 11:08 AM.

  6. #6
    Registered User
    Join Date
    10-23-2017
    Location
    North Carolina
    MS-Off Ver
    Office 2010
    Posts
    13

    Re: need to sort three sheets differently in same workbook

    Here you go
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-23-2017
    Location
    North Carolina
    MS-Off Ver
    Office 2010
    Posts
    13

    Re: need to sort three sheets differently in same workbook

    I think I did that right?

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: need to sort three sheets differently in same workbook

    Yes - that's fine
    Will update the thread tomorrow morning (UK)

  9. #9
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: need to sort three sheets differently in same workbook

    Hi

    Personally, I wouldn't have the buttons attached to the QAT. On there they are very small and can be difficult to distinguish.
    The buttons would really only be applicable to that particular sheet anyway, so I prefer having the buttons on the sheet as in the attached file.

    In this file, I copied just one sheet of your data to a sheet called Data.
    I had to insert a new column at C, and convert your US dates to UK dates for the sort to work correctly for me.
    You can delete that column, and just change Range("C4") to Range("B4") in the macro code, and of course I4 will become H4 and G4 will become F4

    I inserted a few rows at the top of the screen and placed 3 buttons there, title up appropriately and attached the three macros to the buttons.
    At the end of the macro, it writes the Sort order to cell H2 for easy viewing of the current Sort sate.

    Below I just show the Sort 1 for the Date, Time and Event sort, but the others are identical aprt form the choice of sort column and the message in H2 at the finish
    Hope this helps

    Please Login or Register  to view this content.
    Attached Files Attached Files
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  10. #10
    Registered User
    Join Date
    10-23-2017
    Location
    North Carolina
    MS-Off Ver
    Office 2010
    Posts
    13

    Re: need to sort three sheets differently in same workbook

    this is great! so... one question. I like to add blank rows between the dates for easier viewing of the days on the sheet I had as the main one (sorted by date, time, event). This won't be possible to do with it like this, will it?

  11. #11
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: need to sort three sheets differently in same workbook

    No, you can't do that as the blanks would all get sorted to the end.

    Why not just select all of your rows > Right click > Row Height > and choose something like 40.
    Then with all the rows selected, in the Alignment section on the Home Tab, select the middle alignment for Vertical.
    You will then have "white space" (except it is coloured) around the entries making it easier to read.

  12. #12
    Registered User
    Join Date
    10-23-2017
    Location
    North Carolina
    MS-Off Ver
    Office 2010
    Posts
    13

    Re: need to sort three sheets differently in same workbook

    This could work, but I still would ultimately like to have the separate sheets. I have 100+ folks looking at the sheet at any given time. We've been running on this manual version of the calendar for a few years now and I'd just like to keep the layout as easy to use as possible.
    Last edited by sagikerius; 10-23-2017 at 02:12 PM.

+ 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. VBA to sort sheets in a Workbook
    By Taisir in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2016, 09:08 AM
  2. [SOLVED] Need macro that can sort a particular column across many differently named documents.
    By slylikeme in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2013, 03:22 PM
  3. Auto sort same data differently on different sheets
    By Joanna Boetzkes in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2012, 04:10 PM
  4. Replies: 11
    Last Post: 11-28-2011, 07:19 PM
  5. Input to Master and Have Multiple Slaves Each Sort That Data Differently
    By AmeriKen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-11-2009, 10:07 AM
  6. Sort Totals & Linking Sheets in a Workbook
    By eddonaldson in forum Excel General
    Replies: 0
    Last Post: 05-20-2009, 08:04 AM
  7. how can I sort sheets within a workbook in excel
    By piagax2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-29-2005, 06:30 PM

Tags for this Thread

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