展开全部
If (ActiveWorkbook.Path & "\" & Replace(ActiveWorkbook.Name, ".xls", "")) = "" Then MkDir (ActiveWorkbook.Path & "\" & Replace(ActiveWorkbook.Name, ".xls", ""))
lieshu = Range("IV1").End(xlToLeft).Column
For i = 1 To lieshu
hangshu = Range(Cells(65536, i), Cells(65536, i)).End(xlUp).Row
Open ThisWorkbook.Path & "\" & Replace(ActiveWorkbook.Name, ".xls", "") & "\" & CStr(Cells(1, i).Text) & ".txt" For Output As #1
For k = 2 To hangshu
Print #1, Cells(k, i)
Next
Close #1
Next
excel、在附件里