ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Extracting data from workbook1 to workbook2 (https://www.excelbanter.com/excel-worksheet-functions/133394-extracting-data-workbook1-workbook2.html)

[email protected]

Extracting data from workbook1 to workbook2
 
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


vezerid

Extracting data from workbook1 to workbook2
 
On Mar 5, 7:05 pm, wrote:
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



All times are GMT +1. The time now is 10:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com