Sub macro1()
Dim arr(2), i As Long, j As Long, s() As String
arr(0) = [c1].CurrentRegion
arr(1) = [q1].CurrentRegion
arr(2) = [ai1].CurrentRegion
For i = 0 To 2
ReDim s(1 To UBound(arr(i)))
For j = 1 To UBound(arr(i))
s(j) = Join(Application.Index(arr(i), j, 0), " ")
Next
Open "d:\" & i & ".txt" For Binary As #1
Put #1, , Join(s, vbCrLf)
Close #1
Shell "notepad d:\" & i & ".txt", vbNormalFocus
Next
MsgBox "ok"
End Sub
0的问题没有解决 还请其他高手提点
Sub test()
Dim i%, j%, fPath$, myStr$
fPath = "D:\Test2.txt"
i = 1
Do
For j = 1 To 12
myStr = myStr & Cells(i, j) & ","
Next j
i = i + 1
Loop Until Cells(i, 1) = ""
Open fPath For Output As #1
Print #1, myStr
Close
End Sub
另存为 文本
为啥要导出?复制粘贴不行吗?