|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 按钮1_Click()
Set d = CreateObject("scripting.dictionary")
arr = Sheets("班级").UsedRange
For j = 2 To UBound(arr)
If Len(arr(j, 3)) > 0 Then
If Not d.exists(arr(j, 3)) Then
Set d(arr(j, 3)) = CreateObject("scripting.dictionary")
End If
d(arr(j, 3))(j) = ""
End If
Next j
Application.ScreenUpdating = False
r = 1
With Sheets("各班座次表")
.UsedRange.ClearContents
For Each k In d.keys
.Cells(r, 1).Resize(1, 8) = arr
.Cells(r, 10).Resize(1, 8) = arr
c = 0
rx = 1
For Each kk In d(k).keys
If rx = 33 Then
c = 9
rx = 1
End If
For i = 1 To 8
.Cells(rx + r, c + i) = arr(kk, i)
Next i
rx = rx + 1
Next kk
r = r + 33
Next k
End With
Application.ScreenUpdating = True
End Sub
|
评分
-
1
查看全部评分
-
|