1-2.txt1-3.txt1-4.txt1-1.txt1-5.txtHello
I am trying to get excel to export a named row column 1, column2, and Column 3. column 3 is empty and used to create a blank line in the text file. the largest worksheet is 180 rows in length. The method I found that I have been able to use creates a macro of 2800 lines which creates an error because it is to long. So I am only able to create 40 text files at a time. hopefuly creating a range will be easier.
I need to figure out how to do this as a range A1, B1 and aline break then the next 8 ranges A2, B9 preferable with a line break(space between lines)
then the next .txt page range A2, B2 line break 8 ranges A1, B9
Basicly the problem is for each seperate text i need to set the ranges because they are different on each page
I have a small Working snippet of how I am currently exporting for review.
Any help would be greatly appriciated
Sub MakeTXT() Open "C:\Users\Warren\Desktop\Extracted\1-1.txt" For Output As #1 Print #1, Cells(1, 1) Print #1, Cells(1, 2) Print #1, Cells(1, 3) Print #1, Cells(1, 1) Print #1, Cells(1, 2) Print #1, Cells(1, 3) Print #1, Cells(2, 1) Print #1, Cells(2, 2) Print #1, Cells(2, 3) Print #1, Cells(3, 1) Print #1, Cells(3, 2) Print #1, Cells(3, 3) Print #1, Cells(4, 1) Print #1, Cells(4, 2) Print #1, Cells(4, 3) Print #1, Cells(5, 1) Print #1, Cells(5, 2) Print #1, Cells(5, 3) Print #1, Cells(6, 1) Print #1, Cells(6, 2) Print #1, Cells(6, 3) Print #1, Cells(7, 1) Print #1, Cells(7, 2) Print #1, Cells(7, 3) Close Open "C:\Users\Warren\Desktop\Extracted\1-2.txt" For Output As #2 Print #2, Cells(2, 1) Print #2, Cells(2, 2) Print #2, Cells(2, 3) Print #2, Cells(1, 1) Print #2, Cells(1, 2) Print #2, Cells(1, 3) Print #2, Cells(2, 1) Print #2, Cells(2, 2) Print #2, Cells(2, 3) Print #2, Cells(3, 1) Print #2, Cells(3, 2) Print #2, Cells(3, 3) Print #2, Cells(4, 1) Print #2, Cells(4, 2) Print #2, Cells(4, 3) Print #2, Cells(5, 1) Print #2, Cells(5, 2) Print #2, Cells(5, 3) Print #2, Cells(6, 1) Print #2, Cells(6, 2) Print #2, Cells(6, 3) Print #2, Cells(7, 1) Print #2, Cells(7, 2) Print #2, Cells(7, 3) Close Open "C:\Users\Warren\Desktop\Extracted\1-3.txt" For Output As #3 Print #3, Cells(3, 1) Print #3, Cells(3, 2) Print #3, Cells(3, 3) Print #3, Cells(1, 1) Print #3, Cells(1, 2) Print #3, Cells(1, 3) Print #3, Cells(2, 1) Print #3, Cells(2, 2) Print #3, Cells(2, 3) Print #3, Cells(3, 1) Print #3, Cells(3, 2) Print #3, Cells(3, 3) Print #3, Cells(4, 1) Print #3, Cells(4, 2) Print #3, Cells(4, 3) Print #3, Cells(5, 1) Print #3, Cells(5, 2) Print #3, Cells(5, 3) Print #3, Cells(6, 1) Print #3, Cells(6, 2) Print #3, Cells(6, 3) Print #3, Cells(7, 1) Print #3, Cells(7, 2) Print #3, Cells(7, 3) Close Open "C:\Users\Warren\Desktop\Extracted\1-4.txt" For Output As #4 Print #4, Cells(4, 1) Print #4, Cells(4, 2) Print #4, Cells(4, 3) Print #4, Cells(1, 1) Print #4, Cells(1, 2) Print #4, Cells(1, 3) Print #4, Cells(2, 1) Print #4, Cells(2, 2) Print #4, Cells(2, 3) Print #4, Cells(3, 1) Print #4, Cells(3, 2) Print #4, Cells(3, 3) Print #4, Cells(4, 1) Print #4, Cells(4, 2) Print #4, Cells(4, 3) Print #4, Cells(5, 1) Print #4, Cells(5, 2) Print #4, Cells(5, 3) Print #4, Cells(6, 1) Print #4, Cells(6, 2) Print #4, Cells(6, 3) Print #4, Cells(7, 1) Print #4, Cells(7, 2) Print #4, Cells(7, 3) Close Open "C:\Users\Warren\Desktop\Extracted\1-5.txt" For Output As #5 Print #5, Cells(5, 1) Print #5, Cells(5, 2) Print #5, Cells(5, 3) Print #5, Cells(2, 1) Print #5, Cells(2, 2) Print #5, Cells(2, 3) Print #5, Cells(3, 1) Print #5, Cells(3, 2) Print #5, Cells(3, 3) Print #5, Cells(4, 1) Print #5, Cells(4, 2) Print #5, Cells(4, 3) Print #5, Cells(5, 1) Print #5, Cells(5, 2) Print #5, Cells(5, 3) Print #5, Cells(6, 1) Print #5, Cells(6, 2) Print #5, Cells(6, 3) Print #5, Cells(7, 1) Print #5, Cells(7, 2) Print #5, Cells(7, 3) Print #5, Cells(8, 1) Print #5, Cells(8, 2) Print #5, Cells(8, 3) Close End Sub
Last edited by warren13; 12-10-2011 at 10:23 AM.
Well I hope I have done that correctly I added notes to the code and created a larger example which would continue up to 180 text files are created. But VBA wont allow it to work for more than 40 text files because of how long it ends up
Last edited by warren13; 12-10-2011 at 10:04 AM.
Never mind thanks for the help lolz ("post code in code blocks cause i can't read code thats not in a code block", ya you know who you are! way to delete your posts and hide as well (not the moderator he kindly explained the issue)). I solved the problem on my own.
Last edited by warren13; 12-11-2011 at 12:16 AM.
I deleted his post because you added code tags.
Your post does not comply with Rule 9 of our Forum RULES. If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit. And please never edit a thread in which someone else has responded.
Please leave a message after the beep!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks