PDA

Click to See Complete Forum and Search --> : VBA question


QWERTY
Nov 15th, 1999, 07:41 AM
I have three files opened in Excel and I would like to retrive info from two of them and put it in the third one. I know how to do with just two files, but with three of them I'm confused. How can I write a code so computer knows that now I want cell (1,1) from FirstFile.xls and (2,2) from SecondFile.xls to put it in cells (4,4) and (5,5) respectively in ThirdFile.xls (I know that last part). All of those files are opened using WorkBooks.Open Method

Thanks for your help

------------------
Visual Basic Programmer (at least I want to be one)
------------------
PolComSoft
You will hear a lot about it.



[This message has been edited by QWERTY (edited 11-15-1999).]

john_murphy
Nov 17th, 1999, 10:13 PM
The folowing code has 3 excel sheets book1 book2 and book3

it copies cell a1 from book1 and puts it into book3 a1 then it puts cell a1 in book2 into cell a2 of book3 is this what you want??

You do not have to specify the excel sheet name but can put a number in instead (the order they were opened)

is this what you want to do??
I assume they are already opened (this is easy to do)

any probs please do not hesitate to contact me.

john_m_murphy@hotmail.com
Galway
Ireland

Windows("Book1").Activate
Range("A1").Select
Selection.Copy
Windows("Book3").Activate
Range("A1").Select
ActiveSheet.Paste
Windows("Book2").Activate
Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Book3").Activate
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False


------------------
Slan