dim arr,i
arr=range("a1").currentregion
open "1.txt" for output as #1
for i=1 to ubound(arr)
print #1, arr(i,1)
next i
close #1
end sub
用法:运行代码,结果会生成在excel所在的文件夹下面的output.txt中。如果想指定运算区域,则将,选中你想要挑选的区域,'Set zon = Application.InputBox("please choose the zone", Type:=8)前的 ' 去掉然后添加到 Set zon = Range("A1:Z1000")前面。Sub output()
Dim zon As Range
Dim ttr, ttc As String
Open ThisWorkbook.Path &"\output.txt" For Output As #1
Set zon = Range("A1:Z1000")
'Set zon = Application.InputBox("please choose the zone", Type:=8)
For Each Rng In zon
If Rng.Font.Color = 255 Then
ttr = Cells(Rng.Row, 1)
ttc = Cells(1, Rng.Column)
Print #1, ttr, ttc, Rng
End If
Next
Close #1
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)