Results 1 to 2 of 2

Thread: VBA question

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    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).]

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Galway, Ireland
    Posts
    316

    Post

    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.

    [email protected]
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width