|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
代码如下。。。
Sub test()
Dim wb As Workbook, sht As Worksheet
Set wb = ThisWorkbook
Set sht = wb.Sheets("sheet1")
arr = sht.[a1].CurrentRegion
Set d = CreateObject("scripting.dictionary")
ReDim brr(1 To UBound(arr), 1 To 1)
For i = 2 To UBound(arr)
s = arr(i, 1)
If Not d.exists(s) Then Set d(s) = CreateObject("scripting.dictionary")
d(s)(i) = i
Next
m = 0
brr(1, 1) = "考室号"
For Each k In d.keys
m = m + 1: x = 0
For Each i In d(k).keys
x = x + 1
If x > 35 Then m = m + 1: x = 0: brr(i, 1) = "第" & m & "考室" Else brr(i, 1) = "第" & m & "考室"
Next
Next
Set d = Nothing
sht.[n1].Resize(UBound(brr)) = brr
Beep
End Sub
|
评分
-
2
查看全部评分
-
|