|
Sub 计算结果保存文本() '请修改下数据定义,测试发现行数多了结果就错了。
Dim a As Long
Static b As Integer
Static c As Integer
Dim tm
Dim ar, br, i&, r&, strJoin
Open ThisWorkbook.Path & "\ " & [E1].Value & ".txt" For Output As #1
Application.ScreenUpdating = False
For a = 1 To [H1] '这里的最外层的循环,每一个执行都需要完成一次新建写入保存,循环C层实际执行了600次数据计算,这结果属于一个文本
Calculate 'a层每执行一次,E1的文件名就会更换成新的。每一个完整的文本保存对象是完全涵盖b层循环的全部结果
For b = 1 To 10
Calculate
For c = 1 To 60
Calculate
strJoin = ""
r = 0
ar = Range("H3", Cells(Rows.Count, "H").End(xlUp))
br = [Q3].CurrentRegion
For i = 1 To UBound(ar)
If ar(i, 1) = 4 Then
r = r + 1
ar(r, 1) = br(i, 1) & "-" & br(i, 2) & "-" & br(i, 3) & "-" & br(i, 4) & "-" & br(i, 5) & "-" & br(i, 6) & "-" & br(i, 7)
strJoin = strJoin & vbCrLf & ar(r, 1)
End If
Next
If strJoin <> "" Then
Print #1, Mid(strJoin, 3)
End If
Next c
Next b
Next a
[J1] = Format(Now() - tm, "HH:mm:ss")
Beep
Application.ScreenUpdating = True
Close #1
End Sub
|
评分
-
1
查看全部评分
-
|