Sub ExportRange()
FirstCol = 1
LastCol = 3
FirstRow = 1
LastRow = 3
Open ThisWorkbook.Path & "\textfile.txt" For Output As #1
For r = FirstRow To LastRow
For c = FirstCol To LastCol
Dim vData As Variant
vData = Cells(r, c).value
If IsNumeric(vData) Then vData = Val(vData)
If c <> LastCol Then
Write #1, vData;
Else
Write #1, vData
End If
Next c
Next r
Close #1
End Sub
|