|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2024.5.7
- Dim arr, brr, d, s
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("scripting.dictionary")
- ReDim brr(1 To 100000, 1 To 100)
- m = 1: n = 1
- On Error Resume Next
- With Sheets("计分")
- brr(1, 1) = .[a1].Value
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 3)
- For i = 2 To UBound(arr)
- If arr(i, 1) <> Empty Then
- s = arr(i, 1)
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- brr(m, 1) = s
- End If
- r = d(arr(i, 1))
- s = arr(i, 2)
- If Not d.exists(s) Then
- n = n + 1
- d(s) = n
- brr(1, n) = s
- End If
- c = d(arr(i, 2))
- brr(r, c) = brr(r, c) + arr(i, 3)
- End If
- Next
- .Columns("G:Z").Clear
- .[g1].Resize(m, n) = brr
- .[g1].Resize(1, n).Interior.Color = 49407
- .[g2].Resize(m - 1, 1).Interior.Color = 5296274
- ActiveWindow.DisplayZeros = False
- Set Rng = .[g1].Resize(m, n)
- With Rng
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- With .Font
- .Name = "微软雅黑"
- .Size = 11
- End With
- End With
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- End Sub
复制代码
|
评分
-
5
查看全部评分
-
|