+ Reply to Thread
Results 1 to 8 of 8

Notepad data to Excel WB with manipulation

  1. #1
    Registered User
    Join Date
    02-12-2011
    Location
    Cork
    MS-Off Ver
    Excel 2010
    Posts
    21

    Notepad data to Excel WB with manipulation

    Hello Everyone,

    I'm very much in the novice bracket when it comes to macros and excel.

    I'm looking for a way to automate something I'm doing manually at present. I hope someone out there will be able to point me in the right direction.

    I have a .txt file (attached) that I would like to construct a macro for. The objective of the macro is to import the 3 sets of numbers into an excel workbook. The first set would be imported into column B, starting at row 10. The second set into column C row 10 and the third into column D row 10. The data sets will be of different lengths. The last row of each column will hold the calculated average of that column.
    I also wish to put column headings into row 9. These will be static and so can be hard programmed.

    I hope that someone can steer me in the right direction.


    With Thanks
    Attached Files Attached Files
    Last edited by Archibald_SM; 02-13-2011 at 04:08 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Notpad data to Excel WB with manipulation

    This code is a "Tweak" of http://www.cpearson.com/excel/imptext.htm

    Please Login or Register  to view this content.
    Last edited by nimrod; 02-12-2011 at 09:41 PM.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Notpad data to Excel WB with manipulation

    This uses the same basic structure as Nimrod's solution but a different method for extracting the data:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    02-12-2011
    Location
    Cork
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Notpad data to Excel WB with manipulation

    Both worked beautifully, Thank you so much!!

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Notpad data to Excel WB with manipulation

    You're welcome. Thanks for the feedback.

    Please can you mark the thread as solved.

    Regards

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Notpad data to Excel WB with manipulation

    the simplest method to import a txt-file

    Please Login or Register  to view this content.
    1=Tab
    2=comma
    3=space
    4=semicolon
    5=nothing
    If you use a userdefined delimiter e.g. the pipeline |

    Please Login or Register  to view this content.
    If you use the method Open you can read the content of the file in 1 go.

    Please Login or Register  to view this content.
    If you want to split the cells according to the 'fieldseparator" you can use 'texttocolumns'.
    In this example the separator is |

    Please Login or Register  to view this content.
    Last edited by snb; 02-13-2011 at 05:47 PM.



  7. #7
    Registered User
    Join Date
    02-12-2011
    Location
    Cork
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Notpad data to Excel WB with manipulation

    All Done...Once again thanks!!

  8. #8
    Registered User
    Join Date
    02-12-2011
    Location
    Cork
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Notepad data to Excel WB with manipulation

    Sorry, I didn't know whether to start a new topic or just continue this one ( I know it's logged as solved so it will probably go unnoticed). Quick question on the above. I am trying to export the calculated ave values to work sheet2 i.e ave value of colB to sheet2 g10; ave value of colC to sheet2 f18 etc.

    If someone could once again point me in the write direction.

    With Thanks.

+ 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