+ Reply to Thread
Results 1 to 6 of 6

Sorting data then exporting to new sheet

  1. #1
    Registered User
    Join Date
    12-06-2006
    Posts
    25

    Sorting data then exporting to new sheet

    I've been trying to figure this out for a while now, but I've realized that I need some help.
    I'm looking to create a macro (command button) that will rearrange 5 columns (A, B, C, D, E) of data by sorting the numeric values of Column C in a descending order.

    Lets say I have...
    A B C D E
    5 2 13 8 8
    1 3 4 4 9
    5 8 9 1 2
    2 3 2 9 10
    etc.

    I want a macro to make it look like this...
    A B C D E
    5 2 13 8 8
    5 8 9 1 2
    1 3 4 4 9
    2 3 2 9 10

    In my application, there will be about 50 rows of data. I then want the macro to (after the data is sorted) export the first 10 rows of data to a new excel sheet.
    For now, I'll be extremely grateful if someone can fill me in on how to just sort the data, but if you can also give me a hint on how to export a range of data that would be great.

    Thanks!

  2. #2
    Forum Contributor
    Join Date
    12-12-2005
    Posts
    667
    Select the columns A to E
    Click Data, Sort, Sort by Column C, Descending
    Best regards,

    Ray

  3. #3
    Registered User
    Join Date
    12-06-2006
    Posts
    25
    I'm trying to do this in VBA and maybe use the AutoSort command?
    Any thoughts/examples on using Autosort?
    I've figured out how to export data into a new sheet though.

    Thanks,
    dkinnz
    Last edited by dkinnz; 01-09-2007 at 04:57 PM.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    This crude code give you any idea's

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Registered User
    Join Date
    12-06-2006
    Posts
    25
    That helped a ton. muchos thanks!

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad it helped

    VBA Noob

+ 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