Hi,
I have the following sub that exports a column (F) from an Excel file to a text file named data.txt. This has been working, but my data set has grown and for some reason this routine does not copy all of the data from column F, stopping at 43,020 lines. I have about 180k lines that need to be pasted into the text file (they are addresses).
Does anyone have any idea why I can't get all of the data in the text file? The file size is about 720Kb - so there should be plenty of space left. Thanks in advance!
I have the following sub that exports a column (F) from an Excel file to a text file named data.txt. This has been working, but my data set has grown and for some reason this routine does not copy all of the data from column F, stopping at 43,020 lines. I have about 180k lines that need to be pasted into the text file (they are addresses).
Does anyone have any idea why I can't get all of the data in the text file? The file size is about 720Kb - so there should be plenty of space left. Thanks in advance!
Code:
Sub exprtToText2()
Dim ff As Long, lRow As Long
' name of your sheet, you may change it if needed
Const NameOfTheSheet As String = "Sheet1"
' update to the folder path, make sure it ends with \
Const sTextTileDirectoryPath As String = "c:\mypathtoproject\redacted"
ff = VBA.FreeFile
With ThisWorkbook.Sheets(NameOfTheSheet)
lRow = Cells(Rows.Count, "F").End(xlUp).row
Open sTextTileDirectoryPath & .Range("F1").Value & "data.txt" For Output Access Write As #ff
Print #ff, Join(Evaluate(Replace(Replace("transpose(#F2:F@)", "#", "'" & NameOfTheSheet & "'!"), "@", lRow)), vbNewLine)
Close #ff
End With
End Sub