+ Reply to Thread
Results 1 to 9 of 9

Copy table from another excel file

Hybrid View

  1. #1
    Registered User
    Join Date
    01-17-2007
    Posts
    3

    Copy table from another excel file

    Hi,

    I'm trying to create a macro for some guys at work who have very little knowledge of excel, so it needs to be really simple to use.

    Basically the user will be working on a workbook, on a specific sheet and I want them to press a button, where they choose a specific file and then the macro automatically copies set cells (always the same cells) from a set tab (name will not change) to the original workbook in a set location.

    I've managed to do most of it but I'm having proplems making the original workbook active using the code below:

    Windows("Enhanced Calculator Template v1.6.xls").Activate

    My problem is that the filename of the original excel workbook will change and be different for each user. Ideally I want a way of creating a string where I can store the filename of the original excel workbook.

    Thanks for all your help.

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Make it a variable, stored in the worksheet ...

    Dim myfile As String
    myfile = Range("A1").Value
    ....
    Windows(myfile & ".xls").Activate
    HTH
    Carim


    Top Excel Links

  3. #3
    Forum Contributor
    Join Date
    11-22-2006
    Posts
    100

    Vocabulary

    Hello Carim,
    I would like to know how almost everyone uses Dim ... as integer or as string at the beginning of each macro and what does it mean for both??? I tried to find out explanations but I could not.
    Thank you

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Explanation about Variables ...
    http://www.cpearson.com/excel/variables.htm

  5. #5
    Forum Contributor
    Join Date
    11-22-2006
    Posts
    100
    Thank you for the link, now i understand!
    cheers

  6. #6
    Registered User
    Join Date
    01-17-2007
    Posts
    3
    Carim,

    Thanks for the pragmatic solution!

+ 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