+ Reply to Thread
Results 1 to 8 of 8

Import a .txt file , and how do I get started in VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    04-12-2007
    Posts
    9

    Import a .txt file , and how do I get started in VBA

    I am a noob to VBA, and not much of a programmer either.
    I appoligize for the grand nature of my question.

    My two questions are can this be done? and Where do I start learning how?

    Can this be done.

    Import a .txt file to a worksheet in a .xls when the .xls is opened.

    sort the data on that work sheet.

    move rows to various worksheets based on the content of a cell in the row

    DON"T save the work, because the next time the .xls is opened new data will have been added to the .txt (I'm thinking making the .xls read only should suffice here)



    Doesn't sound like too big a task. I just want to be sure VBA is the tool to use before I spend days learning it.

    Then the next question.

    What is the best VBA tutorial on the web for someone like me who wants to learn the basics but not become an ace number 1 VBA professional.

    Thanks many times
    Bill

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    All you want is doable, I saw code posted here for importing from a Text File.

    http://www.excelforum.com/showthread.php?t=608284

    As for your other question there are uncountable VBA courses free & for purchase, but I don't think any of them will teach you the "basics2 in a couple of days.
    Last edited by royUK; 07-24-2007 at 01:07 PM.
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    04-12-2007
    Posts
    9
    Thanks RoyUK,

    That looks like one of the bricks I need.

    Meanwhile I have found a tutorial I am looking at.

    So far I have learned a trick of recording a macro to do something then copying the code from that.

    I've got the thing switching to the correct worksheet and sorting the data.

    Next step, search and move the lines of data to the proper sheet, think I'm going to need some "for" or "while" statements for this.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You will need to tidy up recorded code. Can i ask why it is necessary to move the data to other sheets?

  5. #5
    Registered User
    Join Date
    04-12-2007
    Posts
    9
    The .txt file is data about several products.

    Maybe ten rolls of product A and 4 rolls of product B etc....

    Usually about 10 products daily and 100 or so rows of data.

    I need to move each product to it's own page where it is displayed on some dynamic charts (which I learned to make from this forum BTW)


    Right now, each morning I
    download the text file that the product data has been saved in
    Copy to a worksheet in my file.
    sort by product code
    then cut and past all the rows of date for each product to it's respective worksheet.
    Then upload the .xls to a folder on a network drive where management people who say they need this data can ignore it.

    I have determined that I can have the system that writes the data to the text file write directly to the same folder as the .xls is stored in.

    I hope to make Excel suck the data from the text file, sort and move it as needed whenever the the .xls is opened.

    Thus giving management up to the minute data to ignore, and saving my much daily cutting and pasting.

  6. #6
    Registered User
    Join Date
    04-12-2007
    Posts
    9
    continued..
    Even if I can't totally automate this, if I had a macro that would do all the sorting cutting and pasting for me I would be way ahead.

+ 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