View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
vezerid vezerid is offline
external usenet poster
 
Posts: 751
Default 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