+ Reply to Thread
Results 1 to 5 of 5

VBA code to concatenate and preserve formatting

  1. #1
    Registered User
    Join Date
    02-19-2015
    Location
    FR
    MS-Off Ver
    Office 2013
    Posts
    3

    VBA code to concatenate and preserve formatting

    Hello all,

    I have a question with regards to VBA. I'm trying to concatenate multiple columns of data into one column whilst preserving the custom number formatting, that is to say column A's values are all on 3 positions, column B's values are all on 4 positions and column D's values are all on 20 positions.

    In the example attached I have very little data but this VBA needs to generate more than 200,00 rows of concatenated data in one go.

    The excel file attached already has some VBA code but it does not preserve the formatting of the source columns in question.

    Any help would be greatly appreciated.

    Thanks,

    Sleinous

    Test_cid.xlsm

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA code to concatenate and preserve formatting

    You would need to include the TEXT function in the formula you are evaluating to preserve the formatting.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-19-2015
    Location
    FR
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: VBA code to concatenate and preserve formatting

    Thanks for the fast reply! Do you mean in the source columns? A to D? If so, unfortunately I can not format these as text as these 4 columns are in turn the result of another macro that dumps the data into them - the fat that they are custom formatted forces excel to display the data with 0's infront which is vital for the software used.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA code to concatenate and preserve formatting

    No I mean in the formula you are evaluating in your code.

  5. #5
    Registered User
    Join Date
    02-19-2015
    Location
    FR
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: VBA code to concatenate and preserve formatting

    Ah! Got it thanks!

+ 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. [SOLVED] Need VBA code to concatenate and preserve formatting
    By Lexic0n in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-23-2023, 09:59 PM
  2. CONCATENATE question: preserve two spaces?
    By canadave in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 05-05-2011, 08:45 AM
  3. 03/07 Preserve Formatting
    By traci_marie in forum Excel General
    Replies: 0
    Last Post: 09-15-2007, 12:14 PM
  4. [SOLVED] How to preserve formatting with vlookup
    By Mathias in forum Excel General
    Replies: 2
    Last Post: 03-29-2006, 05:40 PM
  5. Preserve Formatting
    By [email protected] in forum Excel General
    Replies: 7
    Last Post: 07-29-2005, 01: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