+ Reply to Thread
Results 1 to 19 of 19

Extract Data from Notepad file into excel

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Extract Data from Notepad file into excel

    Hi:

    I have notepad file.
    i want to extract data from notepad file and put in the excel file as below.

    Line 25 of notepad file needs to go to Sheet1: B1
    Line 26 : A1
    Line 27 : c1
    Line 28 : D1


    Line 31 of notepad file needs to go to Sheet1: B2
    Line 32 : A2
    Line 33 : c2
    Line 34 : D2


    Line 37 of notepad file needs to go to Sheet1: B3
    Line 38 : A3
    Line 39 : c3
    Line 40 : D3

    and so on until the end of the file..

    Let me know if you have any questions.

    I have attached a sample notepad file..

    Thanks

    RM
    Attached Files Attached Files
    Last edited by rizmomin; 02-21-2012 at 12:03 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Extract Data from Notepad file into excel

    are those line numbers correct?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Extract Data from Notepad file into excel

    Yes, why?

    Oh I see, i have corrected ...please check above...thanks
    Basically

    7.65
    2/20/2012 W789548
    GLENDA S MILLER
    191826
    above should go in Row 1 of excel sheet

    26.65
    2/20/2012 W874294
    FRANKIE L HIGGINBOTHAM
    191812
    should go to ROW 2 of excel sheet and so on...

    Please let me know if any questions or if something is wrong..
    Thanks
    RM
    Last edited by rizmomin; 02-21-2012 at 12:04 PM.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract Data from Notepad file into excel

    Hello Martin,

    I suspect not. I think the OP meant rows 25:28, 31:34, 37:40

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Extract Data from Notepad file into excel

    you show
    Please Login or Register  to view this content.
    shouldnt that be
    Please Login or Register  to view this content.
    however paste into col a then in b1 put
    =INDEX($A:$A,COLUMN(Y1)+(ROW(A1)*6)-6) drag across to e1 then down
    Attached Files Attached Files
    Last edited by martindwilson; 02-21-2012 at 12:10 PM.

  6. #6
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Extract Data from Notepad file into excel

    Quote Originally Posted by rizmomin View Post
    Yes, why?
    It's the number of times you mention Line 33 I'm guessing.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Extract Data from Notepad file into excel

    Hi:

    Yes that was in error..i have corrected

    I meant rows 25:28, 31:34, 37:40

    sorry...

    Thanks and would appreciate all the help.

    RM

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Extract Data from Notepad file into excel

    see post #5

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

    Re: Extract Data from Notepad file into excel

    Please Login or Register  to view this content.



  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract Data from Notepad file into excel

    Hi,

    One way

    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Extract Data from Notepad file into excel

    Hi Snd:

    I tried the following but its giving Compile Error "Syntex error"

    I have opened the txt file and it is located "C:\TEST.txt".

    I run the above vb Code in excel but it gives error.

    Please have a look and help...Thanks

    RM

  12. #12
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Extract Data from Notepad file into excel

    I'm guessing it should be:

    Please Login or Register  to view this content.
    Dom

  13. #13
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Extract Data from Notepad file into excel

    Hi Richard:

    Thank you so much for helping, your code will work.
    However i only need information in column A,B,C and D.
    Currently it is pasting the other info in F...
    Please have a look and help ..
    Thanks

    RM

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

    Re: Extract Data from Notepad file into excel

    You only had to add a ):
    Please Login or Register  to view this content.
    @Domski

    Please check what \ means in VBA (this is not an Excelformula): it's the 'int divider'
    Last edited by snb; 02-21-2012 at 01:30 PM.

  15. #15
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract Data from Notepad file into excel

    And I think there's a touch of Eric Morecambe's response to / Andre Previn's "But you're playing all the wrong notes", in snb's code.


    ....all the right notes but not necessarily in the right order.


  16. #16
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Extract Data from Notepad file into excel

    Cheers, didn't know that.

    Dom

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

    Re: Extract Data from Notepad file into excel

    Richard's bonus:

    Please Login or Register  to view this content.

  18. #18
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract Data from Notepad file into excel

    Hi,

    Then just delete column F!

    If you prefer add a last line of code
    Range("F:F").EntireColumn.Delete

    Regards

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

    Re: Extract Data from Notepad file into excel

    without a bonus:

    Please Login or Register  to view this content.

+ 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