找到个导出列的
Sub DaoChu()
Dim I As Integer, J As Long, RW As Long
RW = ActiveSheet.UsedRange.Rows.Count
For I = 1 To 10
Open "D:\" & Chr(Asc("A") + I - 1) & "行.txt" For Output As 1
For J = 1 To RW
Print #1, Range(Chr(Asc("A") + I - 1) & CStr(J)).Value
Next J
Close 1
Next I
MsgBox "数据导出完毕!", vbOKOnly, "导出成功"
End Sub
我想把excel中每一行的数据导出来,每一行生成一个txt文件,找到了导出列的,怎么改?请懂宏的帮助
答案:2 悬赏:70 手机版
解决时间 2021-02-07 02:01
- 提问者网友:欲劫无渡
- 2021-02-06 17:56
最佳答案
- 五星知识达人网友:老鼠爱大米
- 2021-02-06 18:29
Sub DaoChu()
Dim I As Integer, J As Long, RW As Long
RW = ActiveSheet.UsedRange.Rows.Count
CW = ActiveSheet.UsedRange.Columns.Count
For I = 1 To CW
Open "D:\" & Chr(Asc("A") + I - 1) & "行.txt" For Output As 1
For J = 1 To RW
Print #1, Range(Chr(Asc("A") + I - 1) & CStr(J)).Value
Next J
Close 1
Next I
MsgBox "数据导出完毕!", vbOKOnly, "导出成功"
End Sub
Dim I As Integer, J As Long, RW As Long
RW = ActiveSheet.UsedRange.Rows.Count
CW = ActiveSheet.UsedRange.Columns.Count
For I = 1 To CW
Open "D:\" & Chr(Asc("A") + I - 1) & "行.txt" For Output As 1
For J = 1 To RW
Print #1, Range(Chr(Asc("A") + I - 1) & CStr(J)).Value
Next J
Close 1
Next I
MsgBox "数据导出完毕!", vbOKOnly, "导出成功"
End Sub
全部回答
- 1楼网友:由着我着迷
- 2021-02-06 18:57
可以啊,工具-宏-编辑器里,把代码复制出来,让他黏贴到你的位置就行了
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯