Results 1 to 9 of 9

Slight modification to copy paste loop

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-05-2010
    Location
    New York
    MS-Off Ver
    Excel 2016
    Posts
    747

    Slight modification to copy paste loop

    The following code copies data entries in a loop on two seperate worksheets starting in row 5 and then skips every 5 rows to copy the next data entry. Can someone help me change the code to start in row 50 and then skip every 5 rows for the next entry?

    
    Option Explicit
    Sub DataForSTDEVCalc()
    Dim shtR As Worksheet, shtL As Worksheet, i As Long
    Dim shtS As Worksheet
    Dim rCopy As Range, rStep3 As Range
    Dim pRow As Long
    
    Set shtR = Sheets("Raw Price Data")
    Set shtL = Sheets("Raw Price Data Long")
    Set shtS = Sheets("Raw Price Data Short")
    i = 6
    
    
    Do Until shtR.Cells(i, 3) = ""
                 
        Set rCopy = shtR.Cells(i - 2, 1).Resize(4, 16000)
    
        If shtR.Cells(i, 3) = "Long" Then
             
            rCopy.Copy Destination:=shtL.Cells(shtL.Cells(Rows.Count, 26).End(xlUp).Row, 1)(5)
           
        Else
    
            rCopy.Copy Destination:=shtS.Cells(shtS.Cells(Rows.Count, 26).End(xlUp).Row, 1)(5)
           
        End If
        i = i + 5
    Loop
    
    End Sub
    Last edited by rhudgins; 10-19-2010 at 04:10 PM.

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