PC Review


Reply
Thread Tools Rate Thread

2 separate worrkbooks

 
 
ranjan.khan@comcast.net
Guest
Posts: n/a
 
      6th Mar 2007
On Mar 5, 7:05 pm, ranjan.k...@comcast.net 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".

Hi,
I had posted the following on March 3rd I had gotten a response, but
unfortunately it not the totally correct. Can someone help out?

> 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

 
Reply With Quote
 
 
 
 
Zone
Guest
Posts: n/a
 
      7th Mar 2007
Ranjan, copy this sub and paste it in a regular module. If necessary,
change book2.xls to the actual name of the workbook you want to copy to. If
necessary, change the 1 in Sheets(1) to the number of the sheet you want to
copy to (or you can use the name of the sheet, such as Sheet("MySheet").
Display the sheet you want to copy from and click on it to make it active.
Then run the sub.
HTH,
James

Sub CopyAndPaste()
ActiveSheet.Columns(1).Copy
Destination:=Workbooks("book2.xls").Sheets(1).Range("d1")
ActiveSheet.Columns(2).Copy
Destination:=Workbooks("book2.xls").Sheets(1).Range("f1")
ActiveSheet.Columns(5).Copy
Destination:=Workbooks("book2.xls").Sheets(1).Range("h1")
ActiveSheet.Columns(7).Copy
Destination:=Workbooks("book2.xls").Sheets(1).Range("k1")
End Sub

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Mar 5, 7:05 pm, ranjan.k...@comcast.net 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".

> Hi,
> I had posted the following on March 3rd I had gotten a response, but
> unfortunately it not the totally correct. Can someone help out?
>
>> 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
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Separate incoming pop3 e-mail accounts into separate folders!!!!! =?Utf-8?B?U2VhbiBNLg==?= Microsoft Outlook Installation 4 5th Nov 2005 01:31 PM
Open Excel files in separate sessions, not just separate windows? =?Utf-8?B?Qm9iIGF0IERleGlhIERlc2lnbg==?= Microsoft Excel Misc 1 18th Oct 2005 05:46 PM
Keyboard focus issue - form in separate thread/separate appdomain =?Utf-8?B?REpIdWdoZXM=?= Microsoft Dot NET Framework 0 13th Mar 2005 12:07 AM
Accessing separate mailboxes from one account (on two separate, networked computers) Phrank Microsoft Outlook 1 26th Sep 2004 03:58 AM
Need formula to add numbers that meet two separate criteria from two separate columns mshroff Microsoft Excel Misc 2 11th Dec 2003 08:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:11 PM.