Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Excel - Trying to create *.txt file from worksheet

Excel - Trying to create *.txt file from worksheet

Excel - Trying to create *.txt file from worksheet

I'm trying to create a text file for upload into another application from “sheet1” in Excel 97. If I have any blank lines on the text file, I get an error on the upload in the other application. I have a formula that is combining the data from three columns on "sheet1" to one column on "sheet2". The problem is the number of rows will be different each time I run the copy macro. What I'd like to put in the macro is something that copies the formula in cell A1 on "sheet1" to cells A2:A(x) where x is 1 minus the number of rows in "sheet2".

What I've tried is having my formula in rows 1 through 1000 on “sheet1”, had the macro set the cell in "sheet1" to Null if the corresponding cell in "sheet2" is Null. Then had the macro do a copy paste special formulas as values. But when I create the text file, all the rows that are empty are on text file as blank lines.

RE: Excel - Trying to create *.txt file from worksheet

Create a macro that copies by sitting in cell A1 and hit Shift-Ctrl-End. This should select A1 through the bottom/right-most character in the spreadsheet. If it goes beyond the bottom/right-most character you may need to Edit-Clear-All on the remaining columns and rows. Columns: select first completely blank column, hit Shift-Ctrl-Right arrow key, then Edit-Clear-All. Rows: select first completely blank row, hit Shift-Ctrl-Down arrow key, then Edit-Clear-All.

If you're continually using the same Sheet1, this may not work and you'll have to consider using a macro that uses the xlDown/xlUp features. If you need to do that, there are people who will probably write the darn thing for you in "the lounge" at www.wopr.com.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close