Guest User

Untitled

a guest
Jan 20th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. Sub ColumnOut2Text()
  2. Dim i As Long
  3. Dim j As Long
  4. Dim Fno As Integer
  5. Dim OutColumn As String
  6.   Const myPath As String = "C:\txt\"
  7. With Worksheets("Sheet1")
  8. For i = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
  9.  Fno = FreeFile()
  10.  Open myPath & .Cells(i, 1).Value & ".txt" For Output As #Fno
  11.  For j = 1 To .Cells(1, Columns.Count).End(xlToLeft).Column
  12.   OutColumn = .Cells(1, j).Value & Chr(13) & .Cells(i, j).Value & Chr(13)
  13.   Print #Fno, OutColumn
  14.  Next j
  15.  OutColumn = Empty
  16.  Close #Fno
  17. Next i
  18. End With
  19.  Beep
  20. End Sub
Add Comment
Please, Sign In to add comment