|
楼主 |
发表于 2024-11-25 21:47
|
显示全部楼层
Sub 拆分()
Dim arr As Variant, zd
Application.ScreenUpdating = False
arr = Sheet1.UsedRange
Set zd = CreateObject("scripting.dictionary")
For i = 3 To UBound(arr) Step 2
zd(arr(i, 2) & "|" & arr(i + 1, 2) & "|" & arr(i + 1, 4)) = zd(arr(i, 2) & "|" & arr(i + 1, 2) & "|" & arr(i + 1, 4)) + 1
Next
For Each sht In zd.keys
k = k + 1
Sheets("见证记录").Copy Sheets(Sheets.Count)
With ActiveSheet
.Name = k & "." & Split(sht, "|")(0)
.Range("C1") = WorksheetFunction.Text(k, "000")
.Range("E6") = Split(sht, "|")(1)
.Range("F6") = zd(sht)
.Range("G7") = Split(sht, "|")(2)
.Range("E12") = Split(sht, "|")(2)
End With
Next
Set zd = Nothing
Application.ScreenUpdating = True
End Sub |
|