+ Reply to Thread
Results 1 to 5 of 5

Macro concat cell contents and varying text/values

  1. #1
    Registered User
    Join Date
    04-23-2017
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    5

    Macro concat cell contents and varying text/values

    Hi,

    I wrote the following code which inserts new columns after each header (except the first one) and adds coloured columns. However, I need the new inserted column headers to follow the names of the old headers, with _C1/_C2/_C3 added to the end (except for the ID column).

    However, I'm having real issues trying to get the new headers to include the old header names. Every method I've tried has caused a bug as I can't manage to join the old and new variable names. I would really appreciate any help on this!

    INTENDED INPUT:
    ID V1 V2
    001 A1 B1
    002 A2 B2

    INTENDED OUTPUT:
    ID V1 V1_C1 V1_C2 V1_C3 V2 V2_C1 V2_C2 V2_C3
    001 A1 B1
    002 A2 B2



    Please Login or Register  to view this content.
    Thank you so much in advance

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Macro concat cell contents and varying text/values

    Perhaps:-
    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro concat cell contents and varying text/values

    Simply
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-23-2017
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    5

    Re: Macro concat cell contents and varying text/values

    Hi, thanks for both of your replies! jindon, I have used your code and it works, but I'm not sure how to add the colour formatting to this macro, could you assist?

    EDIT:

    Nevermind, might be a bit clumsy but I got it to work! Thanks! :D

    Please Login or Register  to view this content.
    Last edited by btham; 05-14-2017 at 10:14 PM.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro concat cell contents and varying text/values

    "colour formatting" to where?

    If you upload a workbook with before/after, it would help.

    Edit
    Please Login or Register  to view this content.
    Last edited by jindon; 05-14-2017 at 10:54 PM.

+ 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. Macro text replace with Cell contents
    By grezmel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-19-2015, 09:59 AM
  2. [SOLVED] Assistance required copying values instead of cell contents in my macro
    By TJ Saulnier in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-07-2014, 11:05 AM
  3. [SOLVED] Varying validation drop-downs based on varying cell values
    By navarreman1 in forum Excel General
    Replies: 2
    Last Post: 08-08-2013, 08:13 AM
  4. How can I let the macro determine if the contents of a cell is numeric or text
    By NALDO in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-18-2012, 03:15 AM
  5. Replies: 1
    Last Post: 05-25-2012, 11:54 AM
  6. Macro that will clear contents of cell based on format of text in adjacent cell
    By judasdac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2012, 01:56 AM
  7. Can I copy cell contents to an autoshape as text using a macro?
    By Syndrome in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2006, 01:35 PM

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