|
'好像看懂了,再试一下:
Option Explicit
Sub test()
Dim arr, pth, i, j, k, n, brr, crr, ii, m
pth = ThisWorkbook.Path & "\"
With Sheets("底盘工况")
brr = Range("f20:r20" & .Cells(Rows.Count, "f").End(xlUp).Row)
End With
Open pth & "event.aci" For Input As #1
crr = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbNewLine)
Close #1
For ii = 1 To UBound(brr, 1)
If Len(brr(ii, 1)) Then
arr = crr: m = m + 1: n = 0
For i = 0 To UBound(crr)
n = n + 1
If n + 1 > UBound(brr, 2) Then Exit For
For j = i To UBound(crr)
If InStr(arr(j), "ACT_" & n) Then
For k = j To UBound(crr)
If InStr(arr(k), "INPUT") Then
If Len(brr(ii, n + 1)) > 0 Then arr(k) = Replace(arr(k), "0", brr(ii, n + 1))
j = UBound(crr): i = k: Exit For
End If
Next
End If
Next j, i
Open pth & "event" & m & ".aci" For Output As #1
Print #1, Join(arr, vbNewLine)
Close #1
End If
Next
End Sub |
评分
-
1
查看全部评分
-
|