+ Reply to Thread
Results 1 to 3 of 3

How to insert columns and merge the cells via VBA

  1. #1
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    205

    How to insert columns and merge the cells via VBA

    Dear Friends,

    PFA

    The base data is in worksheet Output.

    Is their any macro which can do following steps.
    e.g of "a"
    1. Insert 2 columns after column F.
    2. In D4, enter "Disc. Factor"
    3. In E4, enter "Disc. Amt"
    4. Merge C3, D3, F3
    5. In C1, enter the formula till there is amt.
    6. In C2, Enter the formula till there is amt.
    7. In D5, enter the formula till there is amt.
    8. in E5, enter the formula till there is amt.

    Then goto "b",
    Repeat the above steps.

    Then for "c" and so on.... till there is value.

    Please assist since there are many rows and many columns.
    Doing this exercise manually is very time consuming.
    Attached Files Attached Files

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: 2019 but still use also older versions
    Posts
    7,472

    Re: How to insert columns and merge the cells via VBA

    From the first sight, this thread is more suitable to https://www.excelforum.com/commercial-services/
    For sure not for https://www.excelforum.com/microsoft-windows-help/
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    10-17-2020
    Location
    spain
    MS-Off Ver
    365
    Posts
    5

    Re: How to insert columns and merge the cells via VBA

    If you prefer to do this without VBA, you can try the following:

    Have your data in cells A1:A999 (or such)
    Set cell B1 to "=A1"
    Set cell B2 to "=B1&A2"
    Copy cell B2 all the way down to B999 (e.g. by copying B2, selecting cells B3:B99 and pasting)
    Cell B999 will now contain the concatenated text string you are looking for.
    Epsilon Magazine

+ 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. Replies: 0
    Last Post: 10-02-2016, 07:30 AM
  2. Merge dissimilar data to different columns based on common unique ID / insert lines
    By anakaine in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-24-2016, 10:50 PM
  3. VBA to insert and merge cells until all text in column is visible
    By teaker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2016, 02:13 PM
  4. Merge data from cells on 2nd columns in which the cells of 1st column repeat
    By jagke in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-14-2013, 01:06 PM
  5. [SOLVED] Merge duplicate rows and merge the columns (approx 10 columns)
    By adfeddon in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-02-2012, 11:19 AM
  6. Excel VB Script Required to Insert PDF objects, Merge Cells and Format
    By timepass111 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2011, 07:29 PM
  7. [SOLVED] Merge cells in two columns
    By Martin ©¿& in forum Excel General
    Replies: 4
    Last Post: 02-03-2005, 09:06 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