![]() |
Copy to a specific row
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 |
Copy to a specific row
I usually use
x = Sheets("ERW").Cells(Rows.Count, "a") .End(xlUp).Row+1 -- Don Guillett SalesAid Software "RJH" wrote in message ... 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 |
Copy to a specific row
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 -- Regards, Tom Ogilvy RJH wrote in message ... 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 |
Copy to a specific row
Thanks Tom, it worked perfectly!
RJH "Tom Ogilvy" wrote in message ... 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 -- Regards, Tom Ogilvy RJH wrote in message ... 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 |
All times are GMT +1. The time now is 10:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com