Copy Data from Workbook into specific Worksheet in other Workbook?

Discussion in 'Microsoft Excel Misc' started by kingdt, Mar 16, 2006.

  1. kingdt

    kingdt Guest

    Hope someone can help :confused:

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

    Hope this makes sence and someone can help.

    Thank

    --
    kingd
    -----------------------------------------------------------------------
    kingdt's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3253
    View this thread: http://www.excelforum.com/showthread.php?threadid=52314
     
    kingdt, Mar 16, 2006
    #1
    1. Advertisements

  2. kingdt

    Guest Guest

    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 :confused:
    >
    > 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?action=getinfo&userid=32531
    > View this thread: http://www.excelforum.com/showthread.php?threadid=523143
    >
    >
     
    Guest, Mar 16, 2006
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Guest

    Copy worksheet name into cell in worksheet

    Guest, Jan 16, 2004, in forum: Microsoft Excel Misc
    Replies:
    1
    Views:
    356
    Norman Harker
    Jan 16, 2004
  2. Ken F

    Copy Worksheet 2 into Worksheet 1??

    Ken F, Jan 26, 2004, in forum: Microsoft Excel Misc
    Replies:
    7
    Views:
    253
    Guest
    Feb 11, 2004
  3. DDM
    Replies:
    1
    Views:
    247
    Guest
    May 13, 2004
  4. Guest

    automatic copy cells into other worksheet??

    Guest, Sep 8, 2005, in forum: Microsoft Excel Misc
    Replies:
    2
    Views:
    206
    R.VENKATARAMAN
    Sep 8, 2005
  5. Replies:
    1
    Views:
    312
    Ron de Bruin
    Oct 27, 2005
  6. Guest
    Replies:
    1
    Views:
    331
    robert111
    Aug 4, 2006
  7. amsbam1
    Replies:
    1
    Views:
    259
    Mo Marchese
    Dec 3, 2008
  8. Kram

    Getting specific data into specific cells?

    Kram, Nov 6, 2008, in forum: Microsoft Excel Misc
    Replies:
    0
    Views:
    304
Loading...