+ Reply to Thread
Results 1 to 4 of 4

VBA code to select the columns based on a specific header name

  1. #1
    Registered User
    Join Date
    02-09-2013
    Location
    Florida
    MS-Off Ver
    Excel 2019
    Posts
    85

    VBA code to select the columns based on a specific header name

    I receive this excel file on a daily basis which has over 50 columns. The problem is the order of columns keep changing but the headers are not.

    So I need a vba code to pick these columns based on the header (title) and cut/paste to column A then B then C then D then E. So there are 5 different columns that needs to be cut and paste among 50 columns and place them at the very beginning of columns A thru E.

    Can somone help?

    Thanks

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,158

    Re: VBA code to select the columns based on a specific header name

    For example:
    Please Login or Register  to view this content.
    Last edited by mjr veverka; 12-03-2022 at 06:36 PM.

  3. #3
    Registered User
    Join Date
    02-09-2013
    Location
    Florida
    MS-Off Ver
    Excel 2019
    Posts
    85

    Re: VBA code to select the columns based on a specific header name

    it works

    Thanks

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,015

    Re: VBA code to select the columns based on a specific header name

    Are the column names always the same? If yes, then you can do this by filtering in Power Query to delete all columns in the query except those and load the results to a new page.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. VBA Code to do a Header change , Copy only specific header and paste
    By deepa.iyer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2022, 04:45 AM
  2. [SOLVED] Code to select first row below header after filter
    By Arnebjarne in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-03-2019, 06:19 AM
  3. Select column based on header VBA
    By chilli16 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2018, 08:06 AM
  4. [SOLVED] VBA for printing specific header, specific columns and cells to one page.
    By Chiefsotos in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-02-2017, 11:42 AM
  5. [SOLVED] Copy columns based on header (Without header)
    By Michael_BU in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-15-2014, 08:07 AM
  6. [SOLVED] Select specific columns based on column numbers
    By sandiptemkar in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-08-2014, 10:44 AM
  7. Replies: 2
    Last Post: 10-13-2012, 03:30 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