0

Right now my vba code has this snippet for copying Worksheets("Sheet1").Rows(i).Copy. I have i properly set up so that it will copy the rows I want. However, it is currently copying the entirety of all the specified rows. How can I have it continue to count rows but also only copy from say column A to Q? So a range of i rows from column A to Q

1 Answers1

1

A couple of ways:

Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(i,1),Worksheets("Sheet1").Cells(i,17)).Copy

Or

Worksheets("Sheet1").Range("A" & i & ":Q" & i).Copy

Or

Worksheets("Sheet1").Range("A" & i).Resize(,17).Copy

Depending on the size of the loop the first will be the quickest(See HERE). It can also be shortened with a With block:

With Worksheets("Sheet1")
     .Range(.Cells(i,1),.Cells(i,17)).Copy
End With
Scott Craner
  • 148,073
  • 10
  • 49
  • 81