+ Reply to Thread
Results 1 to 6 of 6

Multi-macro, button to sort by multiple columns

  1. #1
    Registered User
    Join Date
    10-28-2016
    Location
    The Moon, Milkyway Galaxy
    MS-Off Ver
    2013
    Posts
    19

    Cool Multi-macro, button to sort by multiple columns

    Hello programmers!

    How to create a macro that will:
    1. Copy Starting Sheet (A1:L2000 All formulas w/ some cell formatting.)
    2. Create New Workbook
    3. Paste the Values & Formatting of Starting Sheet to New Workbook, Sheet 1
    4. Sort the sheet by "Column Title 1" then by "Column Title 2" then by Column Title 3." This sheet will have headers so the sort can be done by name, also the columns are static so we could use H1 then by K1, then by E1.



    I know it's a bit much, but I hope to some of you Jedis out there it's a simple Death Star to stifle.

    Best,

    DemRulesDoe
    Last edited by DemRulesDoe; 10-28-2016 at 06:32 PM.

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

    Re: Multi-macro, button to sort by multiple columns

    If you record a macro of you doing this manually, what is the resulting code?

    Also regarding
    4. Sort the sheet by "Column Title 1" then by "Column Title 2" then by Column Title 3."
    To you mean three separate sorting operations, the final one being on Column Title 3?

    or do you mean a single sort, sorted by Title Column 1, with duplicate values being ordered by Column Title 2, etc.?
    Last edited by mikerickson; 10-29-2016 at 01:05 AM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

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

    Re: Multi-macro, button to sort by multiple columns

    Except for the sorting part, I think this will do what you want.
    Also, in the OP it sounds like only the new copy is to be sorted?
    Or do you want both the existing Start Sheet to be sorted as well as the newly created worksheet?
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-28-2016
    Location
    The Moon, Milkyway Galaxy
    MS-Off Ver
    2013
    Posts
    19

    Re: Multi-macro, button to sort by multiple columns

    Hi mikerickson,

    This is the resulting code, it works like a charm, but I have a new problem:

    Please Login or Register  to view this content.
    This does everything in my original problem. Now I need to find a VBA function to paste the Values, Source Formatting and the Validation drop downs from the original sheet, all at once. If I use keyboard shortcuts w/ special paste it will overwrite one or the other. (IE: paste validation will not include values/formatting, or if I paste values + formatting it will not include validation. Doing both actions in a sequence also results in nothing.)

    Tried comma separating my special paste functions with no luck:

    Please Login or Register  to view this content.
    Thank you for the quick response by the way!
    Last edited by DemRulesDoe; 10-31-2016 at 01:51 PM.

  5. #5
    Registered User
    Join Date
    10-28-2016
    Location
    The Moon, Milkyway Galaxy
    MS-Off Ver
    2013
    Posts
    19

    Re: Multi-macro, button to sort by multiple columns

    Quote Originally Posted by DemRulesDoe View Post
    This does everything in my original problem. Now I need to find a VBA function to paste the Values, Source Formatting and the Validation drop downs from the original sheet, all at once. If I use keyboard shortcuts w/ special paste it will overwrite one or the other. (IE: paste validation will not include values/formatting, or if I paste values + formatting it will not include validation. Doing both actions in a sequence also results in nothing.)
    Solved: It ended up being easier just creating the validation on the new sheet via the VBA. Thank you very much for the ideas!

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

    Re: Multi-macro, button to sort by multiple columns

    The .Copy method in my code should have brought the validation over to the new workbook (for the cells in the indicated range)

+ 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. Formula to sort columns instead of using the sort button
    By Hyflex in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-17-2016, 10:20 PM
  2. [SOLVED] sort columns with macro button
    By sirdon in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 05-24-2013, 11:22 PM
  3. [SOLVED] Macro button to sort columns
    By sirdon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2013, 08:45 PM
  4. [SOLVED] Compare, Match, and sort multi columns
    By BeyondInvisible in forum Excel General
    Replies: 8
    Last Post: 12-13-2012, 08:12 PM
  5. Sort Button that does not sort Balance Columns
    By hasancem in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2012, 10:31 AM
  6. match and sort by multi columns
    By nachi in forum Excel General
    Replies: 2
    Last Post: 07-22-2011, 05:56 AM
  7. macro to split and sort to multi worksheets
    By r_aggie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2007, 05:52 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