+ Reply to Thread
Results 1 to 7 of 7

Need VBA code to concatenate and preserve formatting

  1. #1
    Registered User
    Join Date
    04-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Need VBA code to concatenate and preserve formatting

    Could anyone show me some code to automatically concatenate a range of cells whilst preserving the original formatting?

    My document consists of around 200 columns and 16000 rows. Each row needs to be concatenated into column A with a "/" delimiter and preserve the original font (around 20 columns have red font which needs to be included in the destination cell).

    Many thanks

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Need VBA code to concatenate and preserve formatting

    Lexic0n,

    Welcome to the Excel Forum.

    To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data scrubbed/removed/changed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.

    The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    04-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Need VBA code to concatenate and preserve formatting

    If this helps, here is some code that I picked up previously and was trying to adapt for my needs (Credit to Erik Van Geit from Mr.Excel boards).


    Please Login or Register  to view this content.

    How can I make this work automatically for all 16000 rows in my document and include the "/" delimiter?

  4. #4
    Registered User
    Join Date
    04-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Need VBA code to concatenate and preserve formatting

    Quote Originally Posted by stanleydgromjr View Post
    Lexic0n,

    Welcome to the Excel Forum.

    To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data scrubbed/removed/changed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.

    The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.

    I've now attached a cut-down example of what I'm trying to do (my original data set in 16000 rows x 200 columns).
    Attached Files Attached Files
    Last edited by Lexic0n; 05-17-2012 at 10:30 AM.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need VBA code to concatenate and preserve formatting

    Here's your code modified.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Need VBA code to concatenate and preserve formatting

    Thank you very much AlphaFrog, that works perfectly.

  7. #7
    Registered User
    Join Date
    02-23-2023
    Location
    Malaysia
    MS-Off Ver
    2016
    Posts
    1

    Re: Need VBA code to concatenate and preserve formatting

    Hi, LexicOn,

    Could you please provide the sample file with the correct VBA code for reference.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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