Hi guys,
I have developed a piece of code that exports my entire worksheet to a .txt file.
Rather than exporting the entire sheet, all i am looking to achieve is export Column A, B and J.
Here's my current code:
Any help appreciated.
I have developed a piece of code that exports my entire worksheet to a .txt file.
Rather than exporting the entire sheet, all i am looking to achieve is export Column A, B and J.
Here's my current code:
Code:
Sub csvfile()
Dim fs As Object, a As Object, i As Integer, s As String, t As String, l As String, mn As String
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\lee\temp.txt", True)
Dim r
Dim c
For r = 1 To Range("A65536").End(xlUp).Row
s = ""
c = 1
While Not IsEmpty(Cells(r, c))
s = s & Cells(r, c) & "|"
c = c + 1
Wend
a.writeline s 'write line
Next r
End Sub
Any help appreciated.