我有一个范围,我想在每次迭代时在列之间交替写入文件。我会有 A1 > B1 > A2 > B2 等,举个例子:
A | B
1 Hello | World
2 Whats | Up
现在我将它放在一个文本文件中:
Hello
World
Whats
Up
我有以下代码将从我的第一列中获取信息,但我坚持在每次迭代时添加第二列:
Sub mac()
Dim fso As New FileSystemObject
Dim stream As TextStream
Set stream = fso.CreateTextFile("F:\Hmmmmm.txt", True)
Range("G2").Select
Do Until IsEmpty(ActiveCell)
stream.WriteLine ActiveCell
' Here I would affectively want stream.WriteLine ActiveCell + 1 Column
ActiveCell.Offset(1, 0).Select
Loop
End Sub