Results 1 to 11 of 11

Complex Parsing and Saving as Multiple Text Documents

Threaded View

johnph Complex Parsing and Saving as... 06-29-2012, 01:28 PM
wallyeye Re: Complex Parsing and... 06-29-2012, 01:55 PM
JBeaucaire Re: Complex Parsing and... 06-29-2012, 02:10 PM
johnph Re: Complex Parsing and... 06-29-2012, 02:25 PM
Leith Ross Re: Complex Parsing and... 06-29-2012, 02:24 PM
johnph Re: Complex Parsing and... 06-29-2012, 02:48 PM
Leith Ross Re: Complex Parsing and... 06-29-2012, 02:58 PM
johnph Re: Complex Parsing and... 06-29-2012, 03:18 PM
Leith Ross Re: Complex Parsing and... 06-29-2012, 03:45 PM
johnph Re: Complex Parsing and... 06-29-2012, 04:07 PM
Leith Ross Re: Complex Parsing and... 06-29-2012, 04:13 PM
  1. #1
    Registered User
    Join Date
    06-29-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    98

    Complex Parsing and Saving as Multiple Text Documents

    Hello Excelforum community,

    This is the first time posting on this forum but I've been a long time "leecher". I am in need of a complex macro that will parse through contents of a worksheet and make mutiple .txt documents. I've tried searching online and through these forums but without any luck. I currently have this...

    Example Data:

    A1

    0/Cat
    1/Young
    1/Old
    1/Mid Age
    0/Dog
    1/Old
    1/Mid Age
    0/Gerbil
    1/Young
    1/Old
    1/Mid Age

    I want the outcome to be three txt documents:


    0/Cat
    1/Young
    1/Old
    1/Mid Age


    0/Dog
    1/Old
    1/Mid Age


    0/Gerbil
    1/Young
    1/Old
    1/Mid Age


    I think what I am looking for is a loop that will parse the sheet and look for the next "0" value. Then something to transform it into mulitple text documents.

    I am currently this code to save the entire worksheet but I need the loop:

    Sub Save() 
        Dim FilePath As String 
        Dim FileName As String 
         
        FileName = "Animal_" & Worksheets("Animals").Range("A2").Value & "_" & _ 
        Format(Now, "yyyy-mm-dd") & "_" & Format(Now, "hhmmss") & ".txt" 
         
        FilePath = "C:\" 
         
        Dim FileNo As Integer 
        Dim x As Long 
        FileNo = FreeFile 
        Open FilePath & FileName For Output As #FileNo 
         
        With Sheets(9) 
            For x = 1 To .Range("A1:A" & .Range("A15536").End(xlUp).row).Count 
                Print #FileNo, .Cells(x, 1).Value 
            Next x 
        End With 
        Close #FileNo 
         
         
    End Sub
    I am also wondering if it is even possible to do this? If not, should I stop trying? Are there any other methods?
    Any help would be greatly appreciated.
    Attached Files Attached Files
    Last edited by johnph; 06-29-2012 at 03:16 PM.

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