+ Reply to Thread
Results 1 to 2 of 2

Copy Data from Workbook into specific Worksheet in other Workbook?

  1. #1
    Registered User
    Join Date
    03-16-2006
    Posts
    81

    Question Copy Data from Workbook into specific Worksheet in other Workbook?

    Hope someone can help

    What I want to do is have a macro that copies the same cells from 10 different specifically named excel files and pastes them onto the relevant worksheet within another workbook. All the files will be within 1 folder.

    Hope this makes sence and someone can help.

    Thanks

  2. #2
    Tom Ogilvy
    Guest

    RE: Copy Data from Workbook into specific Worksheet in other Workbook?

    here is some pseudo code
    Dim sname as String
    Dim bk as Workbook
    Dim rng as Range
    sname = dir("C:\Myfolder\Myfile*.xls")
    do while sName <> ""
    set bk = workbooks.open("C:\MyFolder\" & sName)
    set rng = bk.worksheets(1).Range("A1:A10")
    rng.copy thisworkbook.worksheets( _
    left(sName,len(sname)-4)).Range("A1")
    bk.close Savechanges:=False
    sName = dir()
    Loop

    Obviously I don't know how "particular" or "relevant" should be specifically
    implemented in the code.


    --
    Regards,
    Tom Ogilvy

    "kingdt" wrote:

    >
    > Hope someone can help
    >
    > What I want to do is have a macro that copies the same cells from 10
    > different specifically named excel files and pastes them onto the
    > relevant worksheet within another workbook. All the files will be
    > within 1 folder.
    >
    > Hope this makes sence and someone can help.
    >
    > Thanks
    >
    >
    > --
    > kingdt
    > ------------------------------------------------------------------------
    > kingdt's Profile: http://www.excelforum.com/member.php...o&userid=32531
    > View this thread: http://www.excelforum.com/showthread...hreadid=523143
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1