+ Reply to Thread
Results 1 to 7 of 7

Sorting in Excel VBA

  1. #1
    Registered User
    Join Date
    01-11-2017
    Location
    London, England
    MS-Off Ver
    2003,2007,2010,2013
    Posts
    65

    Sorting in Excel VBA

    Hi all,

    well i'm just need a simple help or any hint for this case

    i need to go through the active opened excel file then look for any Row start with "Subject" or any other defined words previously with match case then copy the content to opposite cell to a new .xlsx file at the same path on range (A2) and sort the all other records under it


    "Subject" -----> (A2) and sort the rest under it
    "German" -----> (B2) and sort the rest under it
    "English" -----> (C2) and sort the rest under it
    .
    .
    ......etc

    as shown below on screenshot


    http://imgur.com/a/WsyKz


    any help or advise please??

    Thanks in advance

    Cheers

    Ethen


    Cross-posting: http://www.vbaexpress.com/forum/show...222#post356222
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting in Excel VBA

    Assuming for now two sheets in the workbook.... DATA with the raw data and OUTPUT to write the new table into:


    Please Login or Register  to view this content.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-11-2017
    Location
    London, England
    MS-Off Ver
    2003,2007,2010,2013
    Posts
    65

    Re: Sorting in Excel VBA

    Dear Jerry,
    Thanks for your reply and i hope you are doing well

    well sorry again i think it is my fault didn't explain it detailed

    please find that attached sample 2 file

    here is the result i want to get

    From Data tab to Output tab

    all the cells that are next to Red cells (Arabic) are sorted in column (A) at Output tab
    and all cells that are next to Green cells (English) are sorted in column (B) at output tab

    the same thing to all cells next to (Term Arabic) and (Term English) are sorted in column (C) and (D)

    note that there will not be any colors in the file, i'm just explaining



    so i just want the template code for that and i will edit it at two places

    1- the cells to be found then copy the cell next to it
    2- the destination that will copy to at second tab

    i hope you get what i mean and sorry again for disturbing you really

    you are my savior

    cheers

    Ethen
    Attached Files Attached Files
    Last edited by Ethen5155; 02-07-2017 at 02:55 PM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting in Excel VBA

    Like so, then:
    Please Login or Register  to view this content.

    Note: I'm not going to keep bouncing between sites, so you will need to responsibility for getting solutions you've received on one site posted to all the other sites where you have posted the same question. You need to do this, or not crosspost on multiple sites, else you risk wasting people's time as they try to solve a problem on Site A you've already gotten solved on Site B. I know you would never want to do that.

  5. #5
    Registered User
    Join Date
    01-11-2017
    Location
    London, England
    MS-Off Ver
    2003,2007,2010,2013
    Posts
    65

    Re: Sorting in Excel VBA

    Dear Jerry,

    really can't find words to thank you, the code works perfect on sample file but when i run it on original file i got this error

    0.png

    note that my original file contains more than 300,000 rows, does it related to that error?

    and don't worry about other sites, when it is solved here i go there and marked as solved too

    Thanks a lot

    Cheers

    Ethen

  6. #6
    Registered User
    Join Date
    01-11-2017
    Location
    London, England
    MS-Off Ver
    2003,2007,2010,2013
    Posts
    65

    Re: Sorting in Excel VBA

    oh, sorry again my bad

    works well now

    Thanks a lot MR. Excel :D :D

    Best Regards our Hero

    Cheers

    Ethen

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting in Excel VBA

    When you post a question on any forum, if you derive a solution on your own or elsewhere, you should be sure to not only close the other threads, but also be sure to post the your final solution in the alternate thread. Thanks.

+ 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. Replies: 1
    Last Post: 12-16-2015, 01:04 PM
  2. [SOLVED] I require sorting formula in excel sheet with complex sorting.
    By kaminanirav in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-24-2015, 08:16 AM
  3. Replies: 0
    Last Post: 02-24-2014, 11:27 AM
  4. Sorting 2 data ranges by comparing one column in each and sorting to match
    By MDKsmiffy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-17-2013, 03:30 PM
  5. Sorting a range to invert it upside down without sorting by any specific column
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-29-2013, 12:53 PM
  6. [SOLVED] Sorting a range to invert it upside down without sorting by any specific column
    By luv2glyd in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-28-2013, 12:43 PM
  7. Excel Sorting
    By Even Stevens in forum Excel General
    Replies: 6
    Last Post: 09-16-2007, 08:47 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