+ Reply to Thread
Results 1 to 9 of 9

Export Data in Rows, Separated by Empty Cells to Text Files

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    Addis
    MS-Off Ver
    Excel 2013
    Posts
    16

    Export Data in Rows, Separated by Empty Cells to Text Files

    Hello Guys,

    I have data in excel file that has its row separated by empty cells. Now, what I want is, to export each batch of data in the row to a separate text. Please see the attached excel file, it makes every think clear.

    example.xlsx

    Thanks guys.

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Export Data in Rows, Separated by Empty Cells to Text Files

    u want to create text file for that data right
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Registered User
    Join Date
    09-26-2012
    Location
    Addis
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Export Data in Rows, Separated by Empty Cells to Text Files

    yes, different text file for each group of data in rows separated by empty cells.

  4. #4
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Export Data in Rows, Separated by Empty Cells to Text Files

    try this code..

    Step: open the file & press Alt+F11 and run the Macro it will ask you to select the range then select the range which range u want to export to text ok.

    hope this willl work
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-26-2012
    Location
    Addis
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Export Data in Rows, Separated by Empty Cells to Text Files

    Thanks Naveed,

    thanks for your help. but the problem is that I have a huge chunk of data (like 29,000 rows) and the row groups are divided in 10, 100 or 200 set. So each time to export text file, I've to select the whole batch, which is tedious. Instead, I was looking for a vba that automates the whole process.

    Basically what it will do is: For example if my data is in Column A, it will start selecting starting from A1 until it finds empty cell and stops selecting then it exports the selected data to text file and renames the text file based on the number that is on the adjacent column (see example.xlsx) and then starts selecting the next column that's below the empty column and selects rows until it finds empty cell again, exports to txt, renames it and does the whole process again until last row.

  6. #6
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Export Data in Rows, Separated by Empty Cells to Text Files

    ohh ok ok i will provide you updated file tonight . i understand the pain

  7. #7
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Export Data in Rows, Separated by Empty Cells to Text Files

    This should do it..

    Nice that your groups of data is separated by a blank row allowing for the use of .Areas..

    Please Login or Register  to view this content.
    Change the filepath in this line to suit..
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by apo; 01-16-2014 at 09:21 AM.

  8. #8
    Registered User
    Join Date
    09-26-2012
    Location
    Addis
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Export Data in Rows, Separated by Empty Cells to Text Files

    Apo, you just sent me awesomeness in macro enabled workbook I don't know how to thank you enough. Here, take some reputations.

  9. #9
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Export Data in Rows, Separated by Empty Cells to Text Files

    No worries.. glad it helped..

    For your info.. in regards to this solution (if you want to know why/how)...

    Basically what it will do is: For example if my data is in Column A, it will start selecting starting from A1 until it finds empty cell and stops selecting then it exports the selected data to text file and renames the text file based on the number that is on the adjacent column (see example.xlsx) and then starts selecting the next column that's below the empty column and selects rows until it finds empty cell again, exports to txt, renames it and does the whole process again until last row.
    Take a look at :

    .Areas

    Offset

    Scripting.FileSystemObject

    Combine those 3 things.. (plus a beer or x).. and you get what you got..

+ 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. export specific cells to several text files
    By BSJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2013, 04:20 AM
  2. Loop through groups of rows separated by empty cells
    By wmbower in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2012, 02:53 PM
  3. Merge rows with different column of data into one row separated by a empty row
    By phuu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2012, 10:48 AM
  4. How to Import two consecutive text files in same column. No empty rows between.
    By zeroJames in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2011, 03:44 PM
  5. how to export Unicode data to multiple text files
    By world33 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2010, 12:44 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