with data starting from row 2
Sub ExportSomeLinesToText()
Set Zona = ActiveSheet.UsedRange
nrow = Zona.Rows.Count
ncol = Zona.Columns.Count
DestFile = "C:\test\test.txt"
FileNum = FreeFile()
Open DestFile For Output As #FileNum
For RowCount = 2 To nrow ' data starting from row 2
If Cells(RowCount, 1).Value <> Cells(RowCount - 1, 1).Value Then
For ColumnCount = 1 To ncol
Print #FileNum, Cells(RowCount, ColumnCount).Text & " ";
If ColumnCount = ncol Then
Print #FileNum,
Else
'Print #FileNum, ";"; ' optional separator
End If
Next
End If
Next
Close #FileNum
End Sub
Bookmarks