Copy to a specific row

  • Thread starter Thread starter RJH
  • Start date Start date
R

RJH

I'm using this code to copy information from sheet one to my vendor sheet.

Private Sub CommandButton1_Click()
Sheets("ERW").Range("A3:X50000").ClearContents
For Each c In Worksheets("Sheet1").Range("F:F")
If (c) = "ERW" Then
x = Sheets("ERW").Cells(Rows.Count, "a") _
..End(xlUp).Offset(1, 1).Row
c.EntireRow.Copy Sheets("ERW").Cells(x, "a")
End If
Next
End Sub

currently it copies into 'A2' (I have labels in 'A1'). How do I make it
copy starting at 'A3' instead?

Thanks!

RJH
 
Private Sub CommandButton1_Click()
Sheets("ERW").Range("A3:X50000").ClearContents
For Each c In Worksheets("Sheet1").Range("F:F")
If (c) = "ERW" Then
x = Sheets("ERW").Cells(Rows.Count, "a") _
..End(xlUp).Offset(1, 1).Row
if x < 3 then x = 3
c.EntireRow.Copy Sheets("ERW").Cells(x, "a")
End If
Next
End Sub
 
Thanks Tom, it worked perfectly!

RJH


Tom Ogilvy said:
Private Sub CommandButton1_Click()
Sheets("ERW").Range("A3:X50000").ClearContents
For Each c In Worksheets("Sheet1").Range("F:F")
If (c) = "ERW" Then
x = Sheets("ERW").Cells(Rows.Count, "a") _
.End(xlUp).Offset(1, 1).Row
if x < 3 then x = 3
c.EntireRow.Copy Sheets("ERW").Cells(x, "a")
End If
Next
End Sub
 
Back
Top