+ Reply to Thread
Results 1 to 12 of 12

VBA code to find partial matching word and export to notepad

  1. #1
    Registered User
    Join Date
    12-18-2016
    Location
    Azerbaijan
    MS-Off Ver
    xp
    Posts
    5

    Post VBA code to find partial matching word and export to notepad

    Hello guys. I need your help. Really appreciate your any help. I need to develop a VBA code that I can export the rows which contains a word (example, "Home" )to notepad as a text file. In the Column D there is some information and within this information there is a certain word and I need to find this rows and export. Looking for any help from you. thank you in advance.

  2. #2
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: VBA code to find partial matching word and export to notepad

    Hi and welcome!
    As soon as you didn't provide any sample file with data to work with - please find my version attached.
    If searched word is found in column D - it will be exported to the txt file.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-18-2016
    Location
    Azerbaijan
    MS-Off Ver
    xp
    Posts
    5

    Re: VBA code to find partial matching word and export to notepad

    Thank you Kasan

    But I have value from A to N and I want to state filename as following

    filename = ThisWorkbook.Path & "/EURindex as of date" & Format(Now, "dd.mm.yy") & ".txt"

    How I can do this?

    Thank you

  4. #4
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: VBA code to find partial matching word and export to notepad

    This version will export row values from A to N if column D value contains searched word.
    I'm not sure how you need to export all those values? Do you need spaces or some symbol between values?
    In case you need to separate values from excel file - adjust line of code where variable output is formed.

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: VBA code to find partial matching word and export to notepad

    ahh, can't edit post... attachment is right here
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: VBA code to find partial matching word and export to notepad

    I think that there would be a line to empty output string
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  7. #7
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: VBA code to find partial matching word and export to notepad

    @YasserKhalil
    Yeah, you are right, thanks!

  8. #8
    Registered User
    Join Date
    12-18-2016
    Location
    Azerbaijan
    MS-Off Ver
    xp
    Posts
    5

    Re: VBA code to find partial matching word and export to notepad

    Yasser that made clear the output. if I want to add special character between each value how I can do that?

  9. #9
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: VBA code to find partial matching word and export to notepad

    Add some character to this line:
    Please Login or Register  to view this content.
    like:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    12-18-2016
    Location
    Azerbaijan
    MS-Off Ver
    xp
    Posts
    5

    Re: VBA code to find partial matching word and export to notepad

    Thank you all of you! Really you helped me much.

  11. #11
    Registered User
    Join Date
    12-18-2016
    Location
    Azerbaijan
    MS-Off Ver
    xp
    Posts
    5

    Re: VBA code to find partial matching word and export to notepad

    Kasan, I noticed that the first row where I have the header disappear due to it does not contain a special word. I tried several ways but it shows error. could you help me please

  12. #12
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: VBA code to find partial matching word and export to notepad

    So you need to extract header and then rows with specific word, right?
    Add red code.

    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)

Similar Threads

  1. Replies: 3
    Last Post: 01-22-2015, 06:21 PM
  2. [SOLVED] VBA to Export to Notepad from Excel.
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 09-20-2013, 01:00 PM
  3. Export data Excel to Notepad
    By roastfreak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2012, 08:05 AM
  4. Replies: 4
    Last Post: 04-26-2011, 04:38 PM
  5. [SOLVED] Export notepad file to Excel
    By Carrie in forum Excel General
    Replies: 2
    Last Post: 02-02-2006, 01:40 PM
  6. [SOLVED] code to export excel table to word
    By mcope in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2005, 10:05 AM
  7. [SOLVED] export file from txt (Notepad)
    By shital shah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-20-2005, 08:06 AM

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