开发者

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 (Co开发者_如何学Golumns 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.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜