用法:运行代码,结果会生成在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
vba代码提供