dj44
02-14-2016, 04:29 PM
Hello folks,
I am needing some assistance from the pros.:grinhalo:
I am trying to adapt this excel macro.
found here. (http://www.mrexcel.com/forum/excel-questions/593439-convert-each-row-spreadsheet-into-txt-xml-file.html)
Sub ExportTextFiles()
'
Dim i As Long
Dim LastDataRow As Long
Dim MyFile As String
Dim fnum
LastDataRow = ActiveSheet.Range("A" & "B" & Rows.Count).End(xlUp).Row
For i = 1 To LastDataRow
MyFile = "C:\Users\DJ-PC\Documents\" & ActiveSheet.Range("C" & i).Value & ".txt"
fnum = FreeFile()
Open MyFile For Output As fnum
Print #fnum, Format(Range("A"&"B" & i))
Close fnum
Next i
End Sub
This is my excel file
15414
Now I tried all sorts of things to gear up this macro such as to concatenate the cells but that didn't work.:work:
Also the file is saved like text soup, the contents are all in a long line.
How can I have my names and addresses coming down vertically including the line breaks, so it looks civilized example
Bruce
Wayne Manor
Gotham City
Planet Earth
The Universe"
XCGHJJD
No:039844
do advise and many cheers for your help on this tricky task:thumb
and thank you very much for helping me
DJ
I am needing some assistance from the pros.:grinhalo:
I am trying to adapt this excel macro.
found here. (http://www.mrexcel.com/forum/excel-questions/593439-convert-each-row-spreadsheet-into-txt-xml-file.html)
Sub ExportTextFiles()
'
Dim i As Long
Dim LastDataRow As Long
Dim MyFile As String
Dim fnum
LastDataRow = ActiveSheet.Range("A" & "B" & Rows.Count).End(xlUp).Row
For i = 1 To LastDataRow
MyFile = "C:\Users\DJ-PC\Documents\" & ActiveSheet.Range("C" & i).Value & ".txt"
fnum = FreeFile()
Open MyFile For Output As fnum
Print #fnum, Format(Range("A"&"B" & i))
Close fnum
Next i
End Sub
This is my excel file
15414
Now I tried all sorts of things to gear up this macro such as to concatenate the cells but that didn't work.:work:
Also the file is saved like text soup, the contents are all in a long line.
How can I have my names and addresses coming down vertically including the line breaks, so it looks civilized example
Bruce
Wayne Manor
Gotham City
Planet Earth
The Universe"
XCGHJJD
No:039844
do advise and many cheers for your help on this tricky task:thumb
and thank you very much for helping me
DJ