Consulting

Results 1 to 3 of 3

Thread: Macro to concatenate cells into a single cell multiple times

  1. #1
    VBAX Newbie
    Joined
    Dec 2016
    Posts
    2
    Location

    Macro to concatenate cells into a single cell multiple times

    Hi
    I have been given a task at work and am after some assistance or at least a point in the right direction if possible please. J
    I need to automate the creation of test scripts, which basically consists of taking the contents data from a row of cells, concatenating them together, then placing it into the middle of a string of text in another cell in another workbook, then replicating this several times.
    For example the initial table will look something like this:
    A B C
    1 Col 1 Col 2 Col 3
    2 B3 C3 D3
    3 B4 C4 D4
    4 B5 C5 D5

    Then the test script template will look something like this (in a separate Excel workbook).
    Test Name Test Description Step Step Description
    Test 1 SQL to confirm (B3) PR Data Migrated ()
    1 Step 1
    2 Step 2
    3 Field: ()
    Test 2 SQL to confirm () PR Data Migrated ()
    1 Step 1
    2 Step 2
    3 Field: ()
    Test 3 SQL to confirm () PR Data Migrated ()
    1 Step 1
    2 Step 2
    3 Field: ()

    And the end result will look something like this (will be a bit more involved with around 1000 or so rows / Tests) But to give you an idea).
    Test Name Test Description Step Step Description
    Test 1 SQL to confirm (B3) PR Data Migrated (B3, C3, D3)% (B5, C5, D5)
    1
    1 Step 1
    2 Step 2
    3 Field: (B3)
    Test 2 SQL to confirm (B4) PR Data Migrated (B4, C4, D4)
    1 Step 1
    2 Step 2
    3 Field: (B3)
    Test 3 SQL to confirm (B5) PR Data Migratedtyle="width: 224px; height: 20px;">Step 1
    2 Step 2
    3 Field: (B3)

    I am thinking a VBA macro will be the best / only way to achieve this due to the amount of rows of data in order to save time doing it manually and can then also be used in the future.

    Any ideas will be VERY much appreciated.

    Thanks for taking the time to at least read this.

    Andy

  2. #2
    VBAX Expert Leith Ross's Avatar
    Joined
    Oct 2012
    Location
    San Francisco, California
    Posts
    552
    Location
    Hello Andy,

    It would be handy to have a copy of the workbook to develop and test the code with. Can you post a copy of your workbook?
    Sincerely,
    Leith Ross

    "1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG"

  3. #3
    VBAX Newbie
    Joined
    Dec 2016
    Posts
    2
    Location
    Hi Leith

    Thanks for the reply.

    I am a newbie to this forum, how can I post an excel doc on here please?

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •