Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy from one workbook to another
I want to copy cells f,l,g from workbook bonus to workbook Destination. But
only cells from rows where column A er equal a or c. I got this code here but doesn't work: Sub Control() Workbooks.Open Filename:="c:\bonus.xls" Workbooks.Open Filename:="c:\Destination.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("Ark1") iLastRow = .Cells(.Rows.Count, col).End(xlUp).Row For i = 1 To iLastRow If .Cells(i, col).Value = "a" Or _ .Cells(i, col).Value = "c" Then Workbooks("Destination.xls").Worksheets("Ark1").Ce lls(i, target) = _ .Cells(i, col).Value End If Next i End With End Sub |
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) | |||
copy worksheet from closed workbook to active workbook using vba | Excel Worksheet Functions | |||
Copy a range of cells in an unopened workbook and paste it to the current workbook | Excel Programming |