+ Reply to Thread
Results 1 to 13 of 13

Copy a range, but skip 1st and every 6th row, paste value to end of series

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    45

    Copy a range, but skip 1st and every 6th row, paste value to end of series

    Hoping to seek some assistance on the following.

    I have a range that i want to copy however i want to format the data before pasting (spreadsheet attached)

    Firstly i want to copy a field from Column D in the 1st and every 6th row and paste it to Column E, and loop it to the end of the series (illustrated with 'blue' arrows in the sheet).

    Secondly i want to skip the 1st and every 6th row, when copying the range and paste it into the destination spreadsheet (the row i want to skip has a 'red' line through it)

    Please find my code below.

    Please Login or Register  to view this content.
    Any assistance would be greatly appreciated!
    Attached Files Attached Files
    Last edited by rjnc; 09-14-2015 at 10:31 AM.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Does this help?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Quote Originally Posted by JOHN H. DAVIS View Post
    Does this help?

    Please Login or Register  to view this content.
    Thanks John, the skipping of the row is working fine, however the script for copying of the Site Name (Column D) into Column E doesnt appear to be...
    Being relatively novice will this be easy to incorporate into the existing piece of code that i already have?

    Thanks!

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Can you provide a sample of what your result sheet should look like. Actually I thought I had the Column E part right.

  5. #5
    Registered User
    Join Date
    10-11-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Quote Originally Posted by JOHN H. DAVIS View Post
    Can you provide a sample of what your result sheet should look like. Actually I thought I had the Column E part right.
    Hi John,

    I have attached both files and reattached the code. The code currently works, but without the skipping of the lines or the addition of the Site names.

    In quick summary, the process is to copy the data from Report Sept15, paste it into the Master file after the last record and add the next period (max of column A + 1).

    So any assistance with looping in the site name and then removing the 1st and 6th row would be greatly appreciated.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Maybe?

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-11-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe?

    Please Login or Register  to view this content.
    Very close, i have attached a screen shot, the only small amendments needed are the code seems to be adding some additional lines at the bottom and column A needs to be the 'max' of the column A + 1 not the predetermined number (the max function was in my original code), the last amendment is to only read in the extract file (Report Sept15.xlsx), eg. open and close the file in the background, without having to physically have it open for the macro to run.

    Again appreciate your help on this one John.
    Attached Images Attached Images
    Last edited by rjnc; 09-17-2015 at 04:07 AM.

  8. #8
    Registered User
    Join Date
    10-11-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe?

    Please Login or Register  to view this content.
    Apologies forgot to attach, i have amended my post to include the attachment

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    I can't view screenshots. Can you provide a sample showing what you're getting, and then one showing what you require.

  10. #10
    Registered User
    Join Date
    10-11-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Quote Originally Posted by JOHN H. DAVIS View Post
    I can't view screenshots. Can you provide a sample showing what you're getting, and then one showing what you require.
    No problem, please find the two files attached, one shows the current output based on the code supplied (file - Master File), the second is the ideal output (file - Master File Ideal). As mentioned column A needs to be dynamic (max of column + 1). This was referenced in my original code. Thanks!
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Okay. Try this:

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    10-11-2012
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    Quote Originally Posted by JOHN H. DAVIS View Post
    Okay. Try this:

    Please Login or Register  to view this content.
    Thanks John, absolutely spot on! Cheers!

  13. #13
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy a range, but skip 1st and every 6th row, paste value to end of series

    You're welcome. Glad to help out and thanks for the feedback.

+ 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. Cut and copy VBA - If range has value cut and paste to another cell - if Null Skip
    By Tom_Watson123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2015, 11:13 AM
  2. [SOLVED] select & copy some range and past it to another sheet with sum
    By pedjvak in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-01-2012, 12:24 AM
  3. [SOLVED] Macro for COPY and PAST RANGE of data to ANOTHER workbook
    By Atoms in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2012, 02:45 AM
  4. [SOLVED] macro to Copy paste range skip zero values
    By Ralem in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-25-2012, 04:03 PM
  5. Copy data from a certain range and past multiple times.
    By Butehawk in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-30-2010, 09:15 PM
  6. Copy last formula in column and past into range
    By mtbe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2009, 09:00 PM
  7. hlookup to skip past first found 'lookup_value'
    By Ben Morton in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-23-2008, 08:57 AM

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