+ Reply to Thread
Results 1 to 5 of 5

Help - VBA to automatically reorder columns

  1. #1
    Registered User
    Join Date
    11-28-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    73

    Help - VBA to automatically reorder columns

    Hello,

    Can anyone help me with code will automatically look at columns in an excel sheet and reorder them in a pre-specified order? We already have code that kicks out an error if the correct columns aren't in the excel file, but it has no concern over the order of them. Also, it is preferred that the code takes into account that there may be slight variances in column name - for instance, one group at my company may use a column named "Supplier Name", while another uses a column named "Supplier_Name". Any ideas?

    Thanks,

    Jon S

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Help - VBA to automatically reorder columns

    This is easily done.

    Please supply a list of column names as well as alternate names

  3. #3
    Registered User
    Join Date
    11-28-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Help - VBA to automatically reorder columns

    Thanks in advance for your help. Sorry if this is poorly formatted, but here they are:

    Format:
    Column Name - Alternate 1 - Alternate 2

    supplier_name - Supplier - Supplier_ID
    std_document_number - Doc Number - Doc_Number
    std_revision - rev - revision_no
    title - Title_Name - std_title
    sched_subm_date - sub_date - Submittal
    date_received_from_supplier - rec'd_supp - date rec'd
    date_received_by_resp_pers - rec'd_resp - date rec'd_resp
    date_received_in_dcc - rec'd_dcc - date rec'd_dcc
    returned_to_supplier_subcon - to_supplier - date_supplier_subcon
    document_status - doc status - doc_status
    supplier_or_subcon_doc_nbr - supp_doc_nbr - sup_doc_nbr
    supplier_or_subcon_doc_rev - supp_doc_rev - sup_doc_rev
    responsible_person - RP - resp_person
    Agreement_Nbr - agreement_no - Agree_no
    equipment_number - equipment_no - Eq_no
    distrib_code - distribution_code - dist_code
    work_priority - work_pri - working_priority
    supplier_xmtl_nbr - supp_xmtl_nbr - supp_xmtl_no

    Thanks again for your help!

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Help - VBA to automatically reorder columns

    Hi

    This macro seems to work.

    Please give it a try.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-28-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Help - VBA to automatically reorder columns

    After a little tweaking, works perfectly. Thanks for your help!

+ 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. Reorder First Name and Last Name
    By hokieguy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-07-2014, 08:51 PM
  2. [SOLVED] How to automatically sort the columns (move the columns around)
    By OldGrantonian in forum Excel General
    Replies: 4
    Last Post: 08-18-2013, 07:44 AM
  3. Replies: 4
    Last Post: 04-05-2011, 01:09 PM
  4. Replies: 3
    Last Post: 06-16-2010, 04:23 PM
  5. [SOLVED] reorder function
    By cb chiam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 11:05 AM

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