DCulver
DCulver

Reputation: 1

Copy rows from one tab to another in Excel 2003

How can I code a macro to copy 43 rows at a time into another tab for processing and loop through the routine for Row 1 through Row 4300 (Columns A-P)? The processing done with each pasted range is executing calculations based on the pasted cells and capturing the results in an appended table through another macro. I am using MS Excel 2003.

Upvotes: 0

Views: 964

Answers (1)

Alex P
Alex P

Reputation: 12487

The following code will paste data from Sheet1 in blocks of 43 rows into Sheet2 e.g. A1:P43, A44:A86 etc.

Sub CopyData()
    Dim iRow As Long
    Dim rng As Range

    For iRow = 1 To 4258 Step 43
        Set rng = Range("A" & iRow & ":P" & (iRow + 42))
        rng.Copy Destination:=Worksheets("Sheet2").Range("A1") //Copy into A1:P43 on Sheet2
        //Call your existing Macro here to process data?
    Next
End Sub

Upvotes: 1

Related Questions