+ Reply to Thread
Results 1 to 3 of 3

Sorting arrays using VBA?

  1. #1
    Registered User
    Join Date
    05-25-2011
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    52

    Sorting arrays using VBA?

    example.xlsx
    For a class I'm taking right now we are going to get weekly data for our teams (See top table on attached file). The data is arranged by team name. I want to have a macro rearrange it by highest percent in each city. In the file I have the data that's given and then below I rearranged a few so as to give you an idea of what I'm trying. This is my code so far:
    Please Login or Register  to view this content.
    I filled arrays of each category (team name, selling price, and market share %). I was hoping to be able to basically sort the array by the third row (market share %) and then loop through and paste them into the empty table below. But there are no standard functions for this, and I am struggling with coming up with a way around this. Any ideas? Anything would be appreciated. Thanks.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Sorting arrays using VBA?

    Why not sort on the worksheet? You can record a macro to do so, after you unmerge the cells in col A and separate the data into two tables (one for $ and one for %).
    Last edited by shg; 09-11-2012 at 02:43 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Sorting arrays using VBA?

    First thing. Get rid of merge cells. VBA doesn't work well when cells are merged. And you cant sort when some cells are merged.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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