View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Copy from one workbook to another

Sub Control()

Workbooks("c:|\bonus.xls").Open
Workbooks("c:\departure.xls").Open
CopyData 6
CopyData 7
CopyData 12

End SUb



Sub CopyData(col as long)
Dim iLastRow As Long

With Workbooks("bonus.xls").Worksheets("Sheet1")
iLastRow = .Cells(.Rows.Count,col).End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i,col).Value ="0020 DE" Or _
.Cells(i,col).Value = "0021 DE" Then
.cells(i,col).entirerow.copy _

Workbooks("departure.xls").Worksheets("Sheet1").ce lls(i,"A")
End If
Next i
End With

End SUb


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alen32" wrote in message
lkaboutsoftware.com...
I want to copy from workbook (C:\bonus.xls) rows where column A equal

"0021
DE" or ""0020 DE" and column C equal "DE1100" to

workbook(C:\departure.xls)
and sheet1.
But only rows from colum F,G, and L.