+ Reply to Thread
Results 1 to 6 of 6

MS Excel Multiple Files into Spreadsheet

  1. #1
    Registered User
    Join Date
    01-25-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2007
    Posts
    5

    MS Excel Multiple Files into Spreadsheet

    I am wanting to import multiple txt files into a spreadsheet and am trying to write a macro in VBA for this. I have it all working except for the problem that each new file is inserted horizontally instead of vertically below the previous file. This is a problem because all of the files are the exact same format and need the columns to line up. How can I enter a new line in the code so the next file gets put onto a new line below the last file?

    Here is my code:

    Please Login or Register  to view this content.
    Any help is much appreciated thank you!!!
    Last edited by jaym911; 01-25-2011 at 03:13 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: MS Excel Multiple Files into Spreadsheet

    Hi Jay and welcome to the forum,

    Your code is too hard to read unless you put it in code tabs.

    Edit your origianl post (click the green button under your message)
    Then click on Go Advanced below the message area.
    Select the text that is code and click on the # icon above the message area
    Then click Save.

    We might be able to help buy you can make it easier. Also read the rules and you might even attach a sample file so we can see what your data is with the code.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: MS Excel Multiple Files into Spreadsheet

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    01-25-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: MS Excel Multiple Files into Spreadsheet

    Thank you for that have updated post with code tags to make it more readable for everyone

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: MS Excel Multiple Files into Spreadsheet

    Hi jaym911

    It looks to me like it is your
    Please Login or Register  to view this content.
    You need to calculate where the last row of data is in your accumulation sheet and make that the destination you are going to copy the new data to.

    You need to create a variable and use it to find the last row of data like:
    Please Login or Register  to view this content.
    Then I believe you need to set your
    Please Login or Register  to view this content.
    I hope that helps.

  6. #6
    Registered User
    Join Date
    01-25-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: MS Excel Multiple Files into Spreadsheet

    MarvinP thanks a lot for that it worked perfectly!
    Legend!

+ 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