如何将excel每行单独导出为单独txt文件?

2024-12-02 11:38:33
推荐回答(1个)
回答1:

1、在D盘建一文件夹D:\TXT
2、打开数据文件
3、Alt+F11打开VBA编辑器,插入-模块
4、复制以下代码过去
Sub test()
For i = 1 To Range("A65536").End(xlUp).Row
Open "D:\\txt\" & Cells(i, 1).Value & ".txt" For Output As #1data = ""
For j = 1 To 14
data = data & Cells(i, j).Value & vbTab
Next
Print #1, data
Close #1

Next
End Sub
5、运行宏test