Try the following code:
Sub AAA()
Dim FName As Variant
Dim FNum As Integer
Dim LastRow As Long
Dim R As Range
Dim C As Range
Dim S As String
Dim WS As Worksheet
Dim StartRow As Long
FName = Application.GetSaveAsFilename(vbNullString, _
"Text Files (*.txt),*.txt")
If FName = False Then
' user cancelled
Exit Sub
End If
FNum = FreeFile
Open FName For Output Access Write As #FNum
Set WS = ActiveSheet
StartRow = 1
With WS
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Set R = WS.Cells(StartRow, "A")
Do Until R.Value = vbNullString
Set C = R.EntireRow.Cells(1, "A")
S = vbNullString
Do Until C.Value = vbNullString
S = S & C.Text & " "
Set C = C(1, 2)
Loop
S = Trim(S)
Print #FNum, S
Set R = R(2, 1)
Loop
Close #FNum
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)