|
代码如下。。。
Sub test()
Application.ScreenUpdating = False
Dim wb As Workbook, sht As Worksheet
Set wb = ThisWorkbook
Set sht = wb.Sheets("反馈表")
arr = sht.[a1].CurrentRegion
f = wb.Path & "\数据表.xlsx"
With Workbooks.Open(f, 0).Sheets("数据表")
brr = .UsedRange
.Parent.Close 0
End With
Set d = CreateObject("scripting.dictionary")
For i = 2 To UBound(brr)
s = brr(i, 1)
ss = brr(i, 2)
y = Replace(Replace(brr(i, 3), "年", "."), "月", ".")
If InStr(arr(2, 1), y) Then
If Not d.exists(s) Then Set d(s) = CreateObject("scripting.dictionary")
d(s)(ss) = ""
End If
Next
ReDim crr(1 To 22, 1 To 6)
For Each k In d.keys
n = 0
For Each kk In d(k).keys
n = n + 1
If n <= 22 Then
crr(n, 1) = n
crr(n, 2) = kk
ElseIf n <= 44 Then
crr(n - 22, 3) = n
crr(n - 22, 4) = kk
Else
crr(n - 44, 5) = n
crr(n - 44, 6) = kk
End If
Next
sht.Copy
With ActiveWorkbook
.SaveAs wb.Path & "\" & k
.Sheets("反馈表").[a4:f25] = crr
.Sheets("反馈表").[a2] = Replace(arr(2, 1), "一年级一一班", k)
.Close 1
End With
Next
Set d = Nothing
Beep
Application.ScreenUpdating = True
End Sub
|
评分
-
2
查看全部评分
-
|