+ Reply to Thread
Results 1 to 8 of 8

Copy and paste multiple cells n number of times

  1. #1
    Registered User
    Join Date
    08-13-2019
    Location
    Los Angeles
    MS-Off Ver
    2016
    Posts
    4

    Copy and paste multiple cells n number of times

    I have given it my best but cannot resolve my code to work.

    I have a sheet that has quantities and dates in 2s across a random number of columns depending on the row see example below:

    Col A Col B Col C Col D Col E Col F
    Row 1 500 9/6/2019 500 11/8/2019 500 1/10/2020
    Row 2 240 9/27/2019 240 10/25/2019 240 11/22/2019
    Row 3 70 8/9/2019 70 9/20/2019 70 10/4/2019

    I am looking to copy all data onto another spreadsheet in multiple of 2 until Row 3 Col F(varies), example:
    Copy and paste into another sheet -
    Row 1 Col A and Col B, Row 1 Col C and Col D, Row 1 Col E and Col F, move to next row at the end of Row 1 and do the same thing, until all data is copied and pasted.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Copy and paste multiple cells n number of times

    Hi Magnadyne,

    Welcome to the forum!!

    Try this (just change the variables I've commented 'Change to suit' if required):

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    08-12-2019
    Location
    Illinois
    MS-Off Ver
    asa
    Posts
    10

    Re: Copy and paste multiple cells n number of times

    This works. thank you for your help.

  4. #4
    Registered User
    Join Date
    08-13-2019
    Location
    Los Angeles
    MS-Off Ver
    2016
    Posts
    4

    Re: Copy and paste multiple cells n number of times

    Trebor76 - Thanks a lot. This works great - I guess I almost had it myself but for the use of the evaluate.

    One question, when I use this code it copies and pastes in the correct sequence except as shown below -

    Col A Col B
    Row 1 500
    Row 2 9/6/2019 500
    Row 3 11/8/2019 500
    Row 4 1/10/2020 500 ....

    I have tried messing around with the code but cannot seem to fix it! Basically column B is one row shorter than column A. Great way to code this out though, thanks!

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Copy and paste multiple cells n number of times

    In your original post you said "quantities and dates in 2s" - so is it that sometimes the data does not come in pairs?

  6. #6
    Registered User
    Join Date
    08-13-2019
    Location
    Los Angeles
    MS-Off Ver
    2016
    Posts
    4

    Re: Copy and paste multiple cells n number of times

    That is what I thought but all information is indeed paired. For some reason the code is pasting the 1st value to A1 without the matching date and after that it is pasting the values in 2s.

  7. #7
    Registered User
    Join Date
    08-13-2019
    Location
    Los Angeles
    MS-Off Ver
    2016
    Posts
    4

    Re: Copy and paste multiple cells n number of times

    Ah I see my issue - although I changed the code for i = 4 and j = 8, my file starts the data on H4 and must throw off 'xltoLeft' and 'xlPrevious'.

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Copy and paste multiple cells n number of times

    Glad you got it sorted and thanks for the rep

    If you could mark the thread as solved it would be appreciated

    Thanks,

    Robert

+ 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: 4
    Last Post: 09-09-2018, 10:52 AM
  2. [SOLVED] Copy range of cells and paste them X number of times with a jump of 4
    By arbazhamayun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2018, 11:25 AM
  3. Macro to copy group of cells and paste multiple times for each row of data
    By muddakinjaz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2016, 01:17 PM
  4. [SOLVED] Find RMA Number and paste the order number and date multiple times
    By intex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-11-2015, 05:31 PM
  5. Copy and Paste a defined number of times...
    By ccxc007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2012, 02:10 AM
  6. [SOLVED] Copy one value and paste it x number of times
    By jcb in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-12-2012, 04:52 PM
  7. Copy then paste/insert X number of times
    By Steve6386 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-04-2010, 04:53 PM

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