Results 1 to 13 of 13

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

Threaded View

  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.

    Sub Update ()
    
    Dim rngDestination As Range, rngSource As Range
    
    Set rngDestination = ThisWorkbook.Worksheets("Data").Range("B" & Rows.Count).End(xlUp).Offset(1)
    
    Workbooks.Open Filename:= _
    "G:\Report\Report Sept15.xlsx"
    fname = ActiveWorkbook.Name
    
    With Workbooks(fname).Worksheets("Extract")
                Set rngSource = .Range("D11", .Range("D" & Rows.Count).End(xlUp).Offset(-1))
            End With
    
    rngDestination.Resize(rngSource.Rows.Count, 1).Value = rngSource.Value
                        
            rngDestination.Offset(, -1).Resize(rngSource.Rows.Count).Value = Application.Max(rngDestination.Parent.Range("A:A")) + 1
                    
    Workbooks("Report Sept15.xlsx").Activate
    ActiveWindow.Close
    
    End Sub
    Any assistance would be greatly appreciated!
    Attached Files Attached Files
    Last edited by rjnc; 09-14-2015 at 10:31 AM.

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