+ Reply to Thread
Results 1 to 4 of 4

How do I export populated cells to a TXT file

Hybrid View

Tworsey How do I export populated... 07-17-2011, 11:08 PM
rylo Re: How do I export populated... 07-18-2011, 12:16 AM
Tworsey Re: How do I export populated... 07-18-2011, 02:35 AM
MrShorty Re: How do I export populated... 07-18-2011, 10:55 AM
  1. #1
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,373

    Re: How do I export populated cells to a TXT file

    A couple of thoughts:

    1) For someone unfamiliar with VBA, I would think the easiest approach would be to avoid VBA altogether. As needed, program the spreadsheet to organize the data the way you want it to appear, then use the Save As... command to save the spreadsheet as a text file (tab delimited or comma delimited as needed). If you need a different delimiter, it would be easy enough to use the CONCATENATE() function to put everything into one cell that belongs in each record, then copy that down a column. Then Save As a text file.

    2) When I've done this sort of thing using VBA, it has involved (and I found all of these adequately described in VBA help to put my code together):
    a) the OPEN statement to create the text file
    b) a loop that loops through each record in the text file
    c) within that loop, code to collect the data for each record and store it in a string variable
    d) a PRINT statement to write the record to the text file

    Hope that helps

    If I understand how you're data is laid out (assuming the data is in sheet1), the 1st option should work well. In column A of sheet2 put =CONCATENATE(sheet1!A1,sheet1!B1,sheet1!C1,sheet1!D1,sheet1!E1). Save sheet2 as a txt file.
    Last edited by MrShorty; 07-18-2011 at 11:03 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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