Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default build text file

Have the following that creates a text file. Problem it does use th entire
sheet that has data. Is it possible to have it only use those rows that are
complete. Here is what I've got.
Thanks to all


Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
' Dim TotalFile As TextStream
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).row
If RowCount 1 Then TotalFile = TotalFile & vbCrLf
For ColCount = 1 To Cells(RowCount, Columns.Count).End(xlToLeft).Column
If ColCount 1 Then TotalFile = TotalFile & ","
TotalFile = TotalFile & Cells(RowCount, ColCount).Value
Next
Next
Print #FF, TotalFile
Close #FF

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default build text file

See if this works

Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
' Dim TotalFile As TextStream
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If WorksheetFunction.CountBlank( _
Range("A" & RowCount & ":F" & RowCount)) = 0 Then

If RowCount 1 Then TotalFile = TotalFile & vbCrLf

For ColCount = 1 To _
Cells(RowCount, Columns.Count).End(xlToLeft).Column
If ColCount 1 Then TotalFile = TotalFile & ","
TotalFile = _
TotalFile & Cells(RowCount, ColCount).Value
Next
End If
Next
Print #FF, TotalFile
Close #FF

"Curt" wrote:

Have the following that creates a text file. Problem it does use th entire
sheet that has data. Is it possible to have it only use those rows that are
complete. Here is what I've got.
Thanks to all


Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
' Dim TotalFile As TextStream
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).row
If RowCount 1 Then TotalFile = TotalFile & vbCrLf
For ColCount = 1 To Cells(RowCount, Columns.Count).End(xlToLeft).Column
If ColCount 1 Then TotalFile = TotalFile & ","
TotalFile = TotalFile & Cells(RowCount, ColCount).Value
Next
Next
Print #FF, TotalFile
Close #FF

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default build text file

I dont know if it is my server or what. When I click on link to read all I
get is a blank page. Got in thru another option in my favorites. This has
happened on others also.
Thanks

"Joel" wrote:

See if this works

Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
' Dim TotalFile As TextStream
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If WorksheetFunction.CountBlank( _
Range("A" & RowCount & ":F" & RowCount)) = 0 Then

If RowCount 1 Then TotalFile = TotalFile & vbCrLf

For ColCount = 1 To _
Cells(RowCount, Columns.Count).End(xlToLeft).Column
If ColCount 1 Then TotalFile = TotalFile & ","
TotalFile = _
TotalFile & Cells(RowCount, ColCount).Value
Next
End If
Next
Print #FF, TotalFile
Close #FF

"Curt" wrote:

Have the following that creates a text file. Problem it does use th entire
sheet that has data. Is it possible to have it only use those rows that are
complete. Here is what I've got.
Thanks to all


Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
' Dim TotalFile As TextStream
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).row
If RowCount 1 Then TotalFile = TotalFile & vbCrLf
For ColCount = 1 To Cells(RowCount, Columns.Count).End(xlToLeft).Column
If ColCount 1 Then TotalFile = TotalFile & ","
TotalFile = TotalFile & Cells(RowCount, ColCount).Value
Next
Next
Print #FF, TotalFile
Close #FF

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default build text file

Not sure if poss added your code lines leaves out row with missing data as it
should. Is it poss to have a msg box come up on missing row. If to much will
create a message about missing data to appear before merge is done. All I
will say if data missing record will not print. Either way will work.
Thanks for help

"Joel" wrote:

See if this works

Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
' Dim TotalFile As TextStream
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If WorksheetFunction.CountBlank( _
Range("A" & RowCount & ":F" & RowCount)) = 0 Then

If RowCount 1 Then TotalFile = TotalFile & vbCrLf

For ColCount = 1 To _
Cells(RowCount, Columns.Count).End(xlToLeft).Column
If ColCount 1 Then TotalFile = TotalFile & ","
TotalFile = _
TotalFile & Cells(RowCount, ColCount).Value
Next
End If
Next
Print #FF, TotalFile
Close #FF

"Curt" wrote:

Have the following that creates a text file. Problem it does use th entire
sheet that has data. Is it possible to have it only use those rows that are
complete. Here is what I've got.
Thanks to all


Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
' Dim TotalFile As TextStream
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).row
If RowCount 1 Then TotalFile = TotalFile & vbCrLf
For ColCount = 1 To Cells(RowCount, Columns.Count).End(xlToLeft).Column
If ColCount 1 Then TotalFile = TotalFile & ","
TotalFile = TotalFile & Cells(RowCount, ColCount).Value
Next
Next
Print #FF, TotalFile
Close #FF

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default build text file

When you get a blank page simply SIGN OUT in the upper right corner of the
Main Webpage at Microsoft. Microsoft added some security features a few
months ago that require you to logout occasionally. I find the problem when
I'm login on more than one PC at a time.

"Curt" wrote:

Not sure if poss added your code lines leaves out row with missing data as it
should. Is it poss to have a msg box come up on missing row. If to much will
create a message about missing data to appear before merge is done. All I
will say if data missing record will not print. Either way will work.
Thanks for help

"Joel" wrote:

See if this works

Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
' Dim TotalFile As TextStream
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If WorksheetFunction.CountBlank( _
Range("A" & RowCount & ":F" & RowCount)) = 0 Then

If RowCount 1 Then TotalFile = TotalFile & vbCrLf

For ColCount = 1 To _
Cells(RowCount, Columns.Count).End(xlToLeft).Column
If ColCount 1 Then TotalFile = TotalFile & ","
TotalFile = _
TotalFile & Cells(RowCount, ColCount).Value
Next
End If
Next
Print #FF, TotalFile
Close #FF

"Curt" wrote:

Have the following that creates a text file. Problem it does use th entire
sheet that has data. Is it possible to have it only use those rows that are
complete. Here is what I've got.
Thanks to all


Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
' Dim TotalFile As TextStream
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).row
If RowCount 1 Then TotalFile = TotalFile & vbCrLf
For ColCount = 1 To Cells(RowCount, Columns.Count).End(xlToLeft).Column
If ColCount 1 Then TotalFile = TotalFile & ","
TotalFile = TotalFile & Cells(RowCount, ColCount).Value
Next
Next
Print #FF, TotalFile
Close #FF



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to build DDE link with text from another cell Bruneski Excel Worksheet Functions 0 June 27th 08 08:16 PM
how to build a formula from a string of text DR Excel Worksheet Functions 2 March 7th 08 12:12 AM
build external ref in formula from text? klp2344 Excel Discussion (Misc queries) 1 January 6th 07 06:06 PM
Using text in cells to build a link to within another file Jon Excel Discussion (Misc queries) 2 August 2nd 05 09:24 PM
How to build build a macro that automatically imports PedroPeso Excel Programming 1 December 26th 03 08:14 PM


All times are GMT +1. The time now is 09:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"