+ Reply to Thread
Results 1 to 3 of 3

VBA to concatenate text with other cell based on value

  1. #1
    Registered User
    Join Date
    07-31-2018
    Location
    Copenhagen
    MS-Off Ver
    2013
    Posts
    30

    VBA to concatenate text with other cell based on value

    Hi all,

    I am using a program that gives output in excel files that needs to be "text to columns" altered. The problem is that the output sometimes needs clean-up before this is possible.

    All correct rows will start with the format "0000XX000000" with 0 being numbers and X being letters.
    In some instances the last cell contains data that are splitted either into the next column (column B) or to the rows below.
    In some instances there will even be blank rows that should be deleted.

    I have attached an example.

    I need a VBA (as the sheet can include more than 1000 rows) that cleans up the sheet and makes it ready to do "text to columns".

    Please let me know if further information is required :-) Thank you very much in advance!

    Kr Anders
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: VBA to concatenate text with other cell based on value

    Here are two versions of the code. Concat1 does exactly what you want. Concat2 takes it a step further and does the text to columns for you. Concat2 also has an option. as it is set up, it removes the quotes. If you want to keep the quotes, comment out the lines with the REPLACE command and remove the comments from the line above them

    Please Login or Register  to view this content.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    07-31-2018
    Location
    Copenhagen
    MS-Off Ver
    2013
    Posts
    30

    Re: VBA to concatenate text with other cell based on value

    Hi Dflak,

    Thank you VERY much for both subs!! They work perfectly :-) This will definately make everything so much easier.

    kr Anders

+ 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. How to concatenate two strings from two different .dat based text files using VBA
    By mahendra.asapu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2015, 06:25 PM
  2. Concatenate a variable # of cells based on 1 criteria into a cell then autofit the text
    By DrummerAndy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-17-2015, 12:05 PM
  3. Concatenate text based on matching name
    By simbalyon303 in forum Excel General
    Replies: 12
    Last Post: 01-17-2015, 05:46 PM
  4. Concatenate text based on cell value
    By jaimealvarez in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2014, 09:29 AM
  5. [SOLVED] Concatenate based on text in a different column
    By yasmin220 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2014, 09:51 AM
  6. Pls help, can we concatenate text based on some criteria lik SUMIFS
    By Shermin in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-22-2013, 04:31 AM
  7. Macro to concatenate or add text to cell value based on another cells value
    By kstrick99999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2012, 01:00 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