|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 全党 于 2024-5-11 11:31 编辑
- <div class="blockcode"><blockquote>Sub 试试()
- Dim r%, i%, j%, c%
- Dim arr, brr
- Set d = CreateObject("scripting.dictionary")
- brr = Worksheets("参数设置").Range("a1").CurrentRegion
- r = UBound(brr)
- For j = 2 To UBound(brr, 2)
- d(brr(1, j)) = Array(brr(2, j), brr(3, j), brr(4, j), brr(5, j), brr(6, j))
- Next
- arr = Worksheets("原始成绩").Range("a1").CurrentRegion
- For i = 5 To UBound(arr, 2)
- bzx = d(arr(2, i))
- For j = 3 To UBound(arr)
- fs = arr(j, i)
- Select Case fs
- Case Is >= bzx(1): arr(j, i) = "优秀"
- Case Is >= bzx(2): arr(j, i) = "良好"
- Case Is >= bzx(3): arr(j, i) = "合格"
- Case Else
- arr(j, i) = "待合格"
- End Select
- Next j, i
- With Worksheets("成绩等级(结果)")
- .Range("a1").Resize(UBound(arr), UBound(arr, 2)) = arr
- .Range("a1").Resize(1, UBound(arr, 2)).Merge
- .Range("a2").Resize(UBound(arr) - 1, UBound(arr, 2)).Borders.LineStyle = 1
- .Columns(3).Delete
- End With
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|