VBA writing in a text file

This code reads from a sheet until a blank cell is found and writes in a text file the results.

Sub writetextfile()

Set fs = CreateObject("Scripting.FileSystemObject")

Set a = fs.CreateTextFile("file.txt", True)

j = 2

While Sheets("sheets 1").Cells(j, 1) <> ""

You can use Range("A1") instead of Cells(1,1) pointing to cell A1 for example.
       a.WriteLine ("" & Sheets("sheets 1").Range("A" & j) & "")
       j = j + 1
Wend

a.Close

End Sub