I'm creating a text file from excel which works fine, but there's a blank line at the bottom of it, which I can't get rid of. Can any one help me?
Here's my code
sFilename = Range("FileLocation"
& Format(Now), "ddmmyyhhmm"
Open sFilename & ".txt" For Output As #1
iRow = C_ROWSTART
For i = 1 To nRows
If IsEmpty(Cells(iRow, 1)) Then
Print #1, "8=abc4.2" & _
",17=" & Cells(iRow, 11) & _
",20=0" & _
",1=111123" & _
",48=" & Cells(iRow, 12) & _
",22=4" & _
",54=" & Cells(iRow, 2) & _
",32=" & Cells(iRow, 3) & _
",31=" & Cells(iRow, 4) & _
",15=22" & _
",75=" & Format(Cells(iRow, 10), "yyyymmdd"
& _
",64=" & Format(Cells(iRow, 6), "yyyymmdd"
& _
",60=" & Format(Cells(iRow, 5), "hhmmss"
& _
",109=" & Cells(iRow, 8) & _
",142=1111"
End If
iRow = iRow + 1
Next
Close #1
cheers
lbob
Here's my code
sFilename = Range("FileLocation"
Open sFilename & ".txt" For Output As #1
iRow = C_ROWSTART
For i = 1 To nRows
If IsEmpty(Cells(iRow, 1)) Then
Print #1, "8=abc4.2" & _
",17=" & Cells(iRow, 11) & _
",20=0" & _
",1=111123" & _
",48=" & Cells(iRow, 12) & _
",22=4" & _
",54=" & Cells(iRow, 2) & _
",32=" & Cells(iRow, 3) & _
",31=" & Cells(iRow, 4) & _
",15=22" & _
",75=" & Format(Cells(iRow, 10), "yyyymmdd"
",64=" & Format(Cells(iRow, 6), "yyyymmdd"
",60=" & Format(Cells(iRow, 5), "hhmmss"
",109=" & Cells(iRow, 8) & _
",142=1111"
End If
iRow = iRow + 1
Next
Close #1
cheers
lbob