Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
I get error message : "subscript out of range"
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
Sorry, error here
Sub Control() Workbooks("c:\bonus.xls").Open Workbooks("c:\departure.xls").Open CopyData 6 CopyData 7 CopyData 12 End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Bob Phillips" wrote in message ... 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. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
still doesn't work samme error "subscript out of range"
|
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
<blush completely wrong syntax
Sub Control() Workbooks.Open Filename:="c:\bonus.xls" Workbooks.Open Filename:="c:\departure.xls" CopyData 6 CopyData 7 CopyData 12 End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Alen32" wrote in message lkaboutsoftware.com... still doesn't work samme error "subscript out of range" |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
Now is working but makro copy entire rows not only three columns
|
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
Sorry, I thought you asked for entire column.
Shoulg F,G,L go tgo A,B,C or F,G,L? -- HTH RP (remove nothere from the email address if mailing direct) "Alen32" wrote in message lkaboutsoftware.com... Now is working but makro copy entire rows not only three columns |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
f,g,l to a,b,c
|
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
Sub Control()
Workbooks.Open Filename:="c:\bonus.xls" Workbooks.Open Filename:="c:\departure.xls" CopyData 6,"A" CopyData 7,"B" CopyData 12,"C" End Sub Sub CopyData(col As Long,target As String) 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 Workbooks("departure.xls").Worksheets("Sheet1").ce lls(i,target) = _ .cells(i,col).Value 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... f,g,l to a,b,c |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook | Excel Worksheet Functions | |||
Excel-how to link source workbook to copy of destination workbook | Excel Worksheet Functions | |||
Copy cells based on conditions in one workbook to another workbook | Excel Discussion (Misc queries) | |||
Need a macro to copy a range in one workbook and paste into another workbook | Excel Programming | |||
Copy a range of cells in an unopened workbook and paste it to the current workbook | Excel Programming |