LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Problem with exported text

The code below works all the way up to the point where it exports the data to
a text file. When I look within the text file I find that it includes bland
rows as well as the rows with the data. I did add a formula to column 1 so
that when they enter a specific value it always makes it a 1. Otherwise it
leaves the cell blank.

=IF(N8<"",1,"") is the formula in column A starting on row 8.

Text file has the following as the results... which goes on for one hundred
rows which is how far down I copied the above formula.

1;;test;;;test;;;;;;;;s;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;

Sub Button1_Click()
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
' This exports the data to a semicolon seperated text file.
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''
Dim fileName As String
'Dim inputRow As String
Dim FNum As Integer
Dim RowNdx As Long
Dim ColNdx As Integer
Dim EndRow As Long
Dim CellValue As String
Dim currPath As String
Dim slnum As String

slnum = UCase(Range("C8:C8").Value)
Application.ScreenUpdating = False
On Error GoTo EndMacro:
FNum = FreeFile
currPath = ActiveWorkbook.Path
fileName = currPath & "\" & slnum & "_Appendix1data.TXT"
With ActiveSheet.UsedRange
EndRow = .Cells(.Cells.Count).Row
End With
Open fileName For Output Access Write As #FNum

If EndRow = 8 Then
For RowNdx = 8 To EndRow
'inputRow = ""
For ColNdx = 1 To 24
If Cells(RowNdx, ColNdx).Value = "" Then
CellValue = ""
Else
CellValue = Cells(RowNdx, ColNdx).Text
End If
' inputRow = inputRow & CellValue & ";"
Next ColNdx
'inputRow = Left(inputRow, Len(inputRow) - 1)
Print #FNum, ' inputRow
Next RowNdx

Else
GoTo EndMacro:
End If

EndMacro:
On Error GoTo 0
Application.ScreenUpdating = True
Close #FNum

MsgBox ("Formated Data is stored in " & fileName)

End Sub
--
Matt


 
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
Data from exported file read as text, when edited becomes a # (pic Jarod Excel Discussion (Misc queries) 1 July 1st 09 02:21 AM
Exported from Access - text has a character before it Brian Excel Discussion (Misc queries) 0 January 31st 08 06:22 PM
Need quotes around exported tab delimited text Carol Grismore Excel Discussion (Misc queries) 0 May 17th 06 06:19 PM
Dates exported as text michael.a7[_2_] Excel Programming 2 March 31st 06 02:04 PM
why are there quotes in my exported text file? Gordon Excel Discussion (Misc queries) 2 February 16th 05 06:59 PM


All times are GMT +1. The time now is 06:39 PM.

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

About Us

"It's about Microsoft Excel"