+ Reply to Thread
Results 1 to 4 of 4

Excel VBA code to merge column header with similar values of a single row

  1. #1
    Registered User
    Join Date
    06-08-2021
    Location
    Canada
    MS-Off Ver
    365
    Posts
    7

    Excel VBA code to merge column header with similar values of a single row

    I have a excel table and I want to merge the column header of a single row (peach color), with the same values. The code has to be a loop to check the next column header and merge accordingly. I have attached a excel table, with some random data and would like the Columns A, A, B, B, C, C, C to be merged as shown in the yellow bar above. Only the header needs to be merged, not the data. Please help

    Example_Data.PNG
    Attached Images Attached Images

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Excel VBA code to merge column header with similar values of a single row

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: Excel VBA code to merge column header with similar values of a single row

    Macro code:
    Please Login or Register  to view this content.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Registered User
    Join Date
    06-08-2021
    Location
    Canada
    MS-Off Ver
    365
    Posts
    7

    Re: Excel VBA code to merge column header with similar values of a single row

    Thanks. I couldn't completely use this code for my data, but certainly got an idea from it.

+ 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 Combine Similar cells and sum the values in the second column
    By Flaughtbread in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-24-2021, 11:14 AM
  2. [SOLVED] sum up of two similar header column
    By Imran368 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-09-2017, 03:19 AM
  3. [SOLVED] Merge cells in corresponding column based on similar values
    By Niclal in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 12-22-2014, 10:54 AM
  4. [SOLVED] vba to pull data for similar value header values mutitple times
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-22-2014, 05:08 AM
  5. [SOLVED] How to merge similar values in a graph
    By Zergonn in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 07-10-2012, 10:53 AM
  6. VBA code To Merge All .csv files into a single excel sheet
    By windslayer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2012, 07:17 PM
  7. How to chart a single column of values similar to a GROUP BY
    By Paddy in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 12-02-2005, 12:30 AM

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