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?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DDM
    Replies:
    1
    Views:
    172
    Guest
    May 13, 2004
  2. Replies:
    1
    Views:
    183
    Ron de Bruin
    Oct 27, 2005
  3. Guest
    Replies:
    1
    Views:
    163
    robert111
    Aug 4, 2006
  4. amsbam1
    Replies:
    1
    Views:
    142
    Mo Marchese
    Dec 3, 2008
  5. Kram

    Getting specific data into specific cells?

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

Share This Page