I would like to split an excel file of 60,000 rows into small text files (.txt) of 5000 rows (or lines) Is there any way I can split one large excel file into many text files?
I could find a macro that creates a text file from Excel data on another forum, but some how it doesn't seem to work in excel 2007
Any help? anyone?
I could find a macro that creates a text file from Excel data on another forum, but some how it doesn't seem to work in excel 2007
Code:
Sub Export()
Dim objFs As Object
Dim objText As Object
Dim strData As String
Dim n As Integer
Set objFs = CreateObject("Scripting.FileSystemObject")
'create the text file with Path & text filename
Set objText = objFs.CreateTextFile("C:\MyExcelData.txt", 1)
'create a string from the data
For n = 0 To 20
strData = strData & ActiveSheet.Range("B2").Offset(n, 0).Text & vbCrLf
Next n
'write the string to the text file
objText.WriteLine (strData)
'close the text file
objText.Close
'remove the file system object
Set objFs = Nothing
End Sub</pre>
Any help? anyone?