Extracting data from workbook1 to workbook2

R

ranjan.khan

Hi,

I would appreciate any VBA code for the following:

I need to extract data from say ColumnA, ColumnB, ColumnE and ColumnG
from "workbook1"
and placed this data in the corresponding columns (ColumnD, ColumnF,
ColumnH, and ColumnK) in "workbook2".

Can you help?

Thanks Ranjan
 
V

vezerid

Hi,

I would appreciate any VBA code for the following:

I need to extract data from say ColumnA, ColumnB, ColumnE and ColumnG
from "workbook1"
and placed this data in the corresponding columns (ColumnD, ColumnF,
ColumnH, and ColumnK) in "workbook2".

Can you help?

Thanks Ranjan

Sub CopyWbk
Dim src, dest
i=1
Set src=Workbooks("Workbook1").Sheets("Sheet1")
Set dest = Workbooks("Workbook1").Sheets("Sheet1")
While src.Cells(i,1)<>""
dest.Cells(i,4)=src.Cells(i,1)
dest.Cells(i,6)=src.Cells(i,2)
dest.Cells(i,8)=src.Cells(i,5)
dest.Cells(i,11)=src.Cells(i,7)
i = i+1
Wend
End Sub

HTH
Kostis Vezerides
 
Top