Results 1 to 3 of 3

Thread: Copy and paste multiple excel files

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    2

    Unhappy Copy and paste multiple excel files

    I have about 5 files that are the same but will be updated by different users everyday. I would like to have a master file that will copy all the information beginning in row 6 down to the first empty row from each of the 5 files. Then I would like for it to paste in the master one after another. I know how to code this procedure with a set number of rows but not when each file length will vary. Can someone please help. A copy of a screen print from excel is attached.
    Attached Images Attached Images  

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    If you need to find out when the first blank row is use something like this....

    Code:
    Sub Get_Last_Row()
    Dim LastRow As Integer
    
    oXLApp.Worksheets("Sheet1").Select
    Range("A1").Select
    Do Until ActiveCell.Value = ""
    ActiveCell.Offset(1, 0).Select
    Loop
    LastRow = ActiveCell.Row
    End Sub
    Then to copy the data you can....

    Code:
    Sub Copy_Date()
    Dim MyRange As Range
    oXLApp.Worksheets("Sheet1").Select
    Set MyRange = Worksheets("Sheet1").Range(Cells(6, 1), Cells(LastRow - 1, 1))
    
    MyRange.Select
    MyRange.Copy
    End Sub
    Hope this helps

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    2

    Talking

    That worked. Thanks so much for your timely response.

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