+ Reply to Thread
Results 1 to 9 of 9

Import, format, convert, print VBA module

  1. #1
    Forum Contributor rinser's Avatar
    Join Date
    02-27-2009
    Location
    Bucharest
    MS-Off Ver
    MS Office 2013
    Posts
    103

    Import, format, convert, print VBA module

    Hi All,

    I was wondering if its possible to build a module that would do the following: a) import a txt file to excel formatting it as text.
    b) then in column D would remove the preceding space.
    c) then convert data in D according to a separately kept Conversion table (or conversion table could be integrated into the code) and print conversion results into column J.
    d) the last step is to print/copy columns A and J so that it looks like the final table in Sheet2.
    Here are files attached.
    sample data.txt
    sample data.xls
    conversion table.xls
    To summarize I need to go from a txt file like the one attached and arrive at the table in Sheet2 of xls file attached.

    Thank you!
    Last edited by rinser; 04-27-2009 at 10:23 AM.

  2. #2
    Registered User
    Join Date
    04-14-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: Import, format, convert, print VBA module

    This code might help.... You will have to change according to your needs
    Please Login or Register  to view this content.
    Last edited by excel_1982; 04-15-2009 at 06:20 AM. Reason: Adding code

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Import, format, convert, print VBA module

    Please edit your post to add code tags.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    04-14-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: Import, format, convert, print VBA module

    @shg

    Sorry about that. Change made

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Import, format, convert, print VBA module

    Please edit your post to use code tags, not quote tags. The forum rules tell all.

  6. #6
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Import, format, convert, print VBA module

    Hi
    Save the attached file in the folder containing sample text files to be imported. run the macro.
    Ravi
    Attached Files Attached Files

  7. #7
    Forum Contributor rinser's Avatar
    Join Date
    02-27-2009
    Location
    Bucharest
    MS-Off Ver
    MS Office 2013
    Posts
    103

    Re: Import, format, convert, print VBA module

    Hi guys,

    I am analyzing the proposed solutions and will report back with the results.

    Thank you!

  8. #8
    Forum Contributor rinser's Avatar
    Join Date
    02-27-2009
    Location
    Bucharest
    MS-Off Ver
    MS Office 2013
    Posts
    103

    Re: Import, format, convert, print VBA module

    Hi ravishankar,

    When I run the macro on my pc it throws an error and points in yellow to this line:
    Please Login or Register  to view this content.
    Do you know what shall I change?

    Cheers,
    Sergiu

  9. #9
    Forum Contributor rinser's Avatar
    Join Date
    02-27-2009
    Location
    Bucharest
    MS-Off Ver
    MS Office 2013
    Posts
    103

    Re: Import, format, convert, print VBA module

    Hi guys,

    I am afraid none of the solutions is working or I don't know how to apply them. The solution of ravishankar is very close but part of the code is hidden it seems and I can't figure out how the two subprocedures work and how to call them both. I am closing the thread and will start a new one for another module similar to this one but a bit more complex and maybe adapt that one to solve also the needs in this one.

    Thanks to all for the input and time!
    Cheers.
    Last edited by rinser; 04-27-2009 at 07:55 AM.

+ 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