Consulting

Results 1 to 4 of 4

Thread: Solved: import data from another workbook

  1. #1
    VBAX Contributor
    Joined
    Mar 2009
    Location
    Indiana
    Posts
    113
    Location

    Solved: import data from another workbook

    Hello all. I am trying to import data without using microsofts wizards because I have so many imports that I need to do that it is starting to strip some of my data out.

    I need help writing some code to preserve the integrity and formats of a particular sheet of a particular workbook, and pasting it into cell A1 of the workbook I need the data to appear in.

    Lets say I have Workbook1.xls open and need data from another file to be imported onto the sheet "Master" of Workbook1.xls. The data I need pasted is all contents from Workbook2.xls and the sheet is called Sheet1. I would like to just be able to paste this data into the code that runs when the file is opened.

    Help would be appreciated. Thanks!

  2. #2
    VBAX Contributor
    Joined
    Mar 2009
    Location
    Indiana
    Posts
    113
    Location
    Oh yeah i forgot to add that that Workbook1.xls is stored in C:\Test\Data and Workbook2.xls is stored in C:\Test\Now

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Is the Source workbook already open when the code is run?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Contributor
    Joined
    Mar 2009
    Location
    Indiana
    Posts
    113
    Location
    No the source workbook would be closed when the code is ran.

Posting Permissions

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