Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default 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.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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.





  #7   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default Copy entire row if...

Thanks guys! Now it works
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Copy entire row if...

glad to help

--
Don Guillett
SalesAid Software

"Sam" wrote in message
...
Thanks guys! Now it works



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy entire row to different worksheet Kcope8302 Excel Worksheet Functions 5 August 17th 09 03:14 PM
Copy entire ranges RJF Excel Worksheet Functions 2 February 17th 06 03:58 PM
how to copy entire row into next row john_liu Excel Programming 2 September 22nd 04 02:17 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM
Copy entire Worksheet how? Stormin' German Excel Programming 2 February 4th 04 12:26 AM


All times are GMT +1. The time now is 04:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"