Sub WriteSales To Text() Dim txtFile As String Dim row As String, column As String Dim nRows As Integer, nColumns As Int
Posted: Tue Jul 12, 2022 8:10 am
Sub WriteSales To Text() Dim txtFile As String Dim row As String, column As String Dim nRows As Integer, nColumns As Integer Dim dataLine As String Substitute the appropriate path and filename in the next line. txtFile = "C:\Temp\Sales.txt" Open txtFile For Output As #1 With wsSales.Range("A1") = nRows Range(.Offset(0, 0), .End(xIDown)).Rows.Count nColumns = Range(.Offset(0, 0), .End(xlToRight)).Columns.Count For now 1 To nRows 'Build data line from data in this wor, separate by tabs. dataLine dataLine & .Cells(rows, column).Value For column=1 To nColumns = End Sub Next End With Close #1 dataLine = dataLine & .Cells(rows, column).Value Don't add a tab after the last piece of data in the row. If column