Copy entire row if...
I need help copying entire row from "table1.xls" if column B is "text1" to
"table2.xls". what is the most simple way of doing this? Thanks -- -Sam |
Copy entire row if...
If Cells(2,"B") = "text1" Then Cells(2,"B").Entirerow.Copy Destination:=Workbooks("table2.xls").Worksheets("S heet1").Range("A1") End If -- HTH RP (remove nothere from the email address if mailing direct) "Sam" wrote in message ... I need help copying entire row from "table1.xls" if column B is "text1" to "table2.xls". what is the most simple way of doing this? Thanks -- -Sam |
Copy entire row if...
Thanks Bob, that was very helpful. There is still one more detail I want to
solve. I want to be able to put more than one row in destination table, so that the data is saved always to next empty row. Because of this I can't order the certain range. |
Copy entire row if...
Sam,
Try something like If Cells(2,"B") = "text1" Then Set oWS = Workbooks("table2.xls").Worksheets("Sheet1") cLastRow = oWS.Cells(Rows.Count,"A").End(xlUp).Row Cells(2,"B").Entirerow.Copy Destination:=.oWS.Cells(cLastRow+1,"A") End If -- HTH RP (remove nothere from the email address if mailing direct) "Sam" wrote in message ... Thanks Bob, that was very helpful. There is still one more detail I want to solve. I want to be able to put more than one row in destination table, so that the data is saved always to next empty row. Because of this I can't order the certain range. |
Copy entire row if...
then change to this idea
With workbooks"table2.xls").worksheets("sheet1") If Cells(2,"B") = "text1" Then x = .Cells(Rows.Count, 1).End(xlUp).Row + 1 Cells(2, "b").EntireRow.Copy .Cells(x, 1) End With end if End Sub If Cells(2,"B") = "text1" Then Cells(2,"B").Entirerow.Copy Destination:=Workbooks("table2.xls").Worksheets("S heet1").Range("A1") End If -- Don Guillett SalesAid Software "Sam" wrote in message ... Thanks Bob, that was very helpful. There is still one more detail I want to solve. I want to be able to put more than one row in destination table, so that the data is saved always to next empty row. Because of this I can't order the certain range. |
Copy entire row if...
Thanks guys! Now it works
|
Copy entire row if...
|
All times are GMT +1. The time now is 12:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com