+ Reply to Thread
Results 1 to 6 of 6

Macro for multiplying the # of rows 3 times and adding add. information in new column

  1. #1
    Registered User
    Join Date
    06-12-2013
    Location
    World
    MS-Off Ver
    Excel 2010
    Posts
    3

    Macro for multiplying the # of rows 3 times and adding add. information in new column

    Hello,

    I am new both in this forum and using VBA. Maybe someone could help me with the code for the problem I am facing.
    Gut feeling says that it should be very easy; though, I can not manage to solve it on my own for the second day by now

    I am trying to create a macro for a task that needs to be performed very often. The problem is that the # of rows of data needed to be processed varies every time.
    I have attached the excel template of the problem.
    The active cells (except headings) from the columns A:B; the work sheet "Data source", should be copied to the sheet "Data after transformation" 3 times; 2nd and 3rd time placing copied columns under previously copied columns. Then data from column C (active cells, sheet "Data source", except headings), should be copied to the sheet "Data after transformation" to the column C. Next to this data in column D, the name Axxx should be repeated (the number of times Axxx is entered is corresponding to the # of newly entered cells in the column C). The same should be repeating while moving data form columns D and E (from sheet "Data source" to sheet "Data after transformation" to column C) and adding names Bxxx and Cxxx in column D, sheet "Data after transformation".

    Hopefully someone could help me with this question.

    Donata
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Macro for multiplying the # of rows 3 times and adding add. information in new column

    You could use this macro:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro for multiplying the # of rows 3 times and adding add. information in new column

    another option
    Please Login or Register  to view this content.
    Last edited by patel45; 06-12-2013 at 12:03 PM.
    If solved remember to mark Thread as solved

  4. #4
    Registered User
    Join Date
    06-12-2013
    Location
    World
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro for multiplying the # of rows 3 times and adding add. information in new column

    Thank you for the help!
    While Antonio's macro seems to work well, when I try to use the one offered by Patel, the error #400 shows up.
    Maybe you know, what could be the reason for this?

    Wish you a nice evening

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro for multiplying the # of rows 3 times and adding add. information in new column

    code error, try this
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-12-2013
    Location
    World
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Macro for multiplying the # of rows 3 times and adding add. information in new column

    Thank you - it works

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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