+ Reply to Thread
Results 1 to 20 of 20

Macro for copying multiple columns and pasting 'n' times to another workbook

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Macro for copying multiple columns and pasting 'n' times to another workbook

    There are two workbooks with names: products and variations.
    product worksheet contains cells as:

    products.jpg

    I want to copy column A and C simultaneously and paste them on column A and B of worksheet variations, 8 times for each row of products worksheet.So, copy as long as there are rows in products worksheet to variations worksheet.

    Eg. according to image attached, total rows copied to variations worksheet should be 32 starting from A2 and C2.

    Thanks

  2. #2
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    anyone here?

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    It Would be better to attach a sample book. Your jp does not show anything

  4. #4
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Thanks for replying.

    products.xlsx
    here it is.
    I want to copy column A and C of above attached file to thisVariations.xlsxfile in columns A and B.
    Each row of first file copied 8 times to another until as many products are there in former.

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Busybee! Thank!
    It looks like both sheets are not on the same workbook. Am I right?

  6. #6
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    yes, different workbooks and sheets

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Busybee! This code is beyond my skills as it requires locating the source and dest files and folders, so I am out of my depth. I have done a very simple code and hopefully, the more able expert should be able to help you. If you do not get any help by the end of the day, I will probably do it with little help from googling it.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Thanks AB33, I have changed abit to ease you,
    here is the new workbook named "newbook" which contains two sheets: products and variations
    here it is:newbook.xlsx

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    I know this is not the solution you are looking for, but as promised if no one comes up to your aid, I will do it. In the mean time, here is the adjusted code.
    I am assuming that, you want to keep the heading on variations sheet, but if you want to overwrite the heading , just the A2, B2 in to A1 and B1.

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Thanks, it worked. Just changed A1 & C1 to A2 & C2. But it should paste each row 8 times.

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    I am not sure if this one works. You need to change the SourceFile and DestFile in to your choice of folders.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    That's alright sir, just changed A1 & C1 to A2 & C2. But it should paste each row 8 times.

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Sorry Busy! You are right. I completley forget that you want to copy each row 8 times.

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    I have got this code from on-line adjsuted it to you needs. I have to cheat by adding another column which shows the number of times each row copies. It is not ideal solution, but something.

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    should it be column D?

  16. #16
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Works awesome, made some modifications.,

    Thanks AB33

  17. #17
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Works awesome, made some modifications.,

    Thanks AB33

  18. #18
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Busybee! I am really sorry that I forget to attach the sheet with the code.
    The code might not make any sense with out the attachment.You have got it right though. Please find attached.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    09-28-2012
    Location
    sweden
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    Thanks, wanted to ask is it possible to copy the image attributes eg. size, type, date modified, dimensions to excel cells without copying image itself to excel just fetching its details from a folder which contains alot of images???

  20. #20
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro for copying multiple columns and pasting 'n' times to another workbook

    This might appear as new request, so may appear we are breaking Form's rules. Please start a new thread with sample attached and specifying your request. If it is a new thead others who are more able than I am will contribute to the solution as well.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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