Sub 各班个人各科进步幅度()
Dim dRank As Object
Set dRank = CreateObject("Scripting.Dictionary")
Dim dStd As Object
Set dStd = CreateObject("Scripting.Dictionary")
Dim dSbj As Object
Set dSbj = CreateObject("Scripting.Dictionary") em = Array("月考2", "期中考")
For n = LBound(em) To UBound(em) Step 1
Set sht = ThisWorkbook.Worksheets("成绩表_" & em(n))
With sht
EndRow = .Cells(.Cells.Rows.Count, 1).End(xlUp).Row
EndCol = .Cells(1, .Cells.Columns.Count).End(xlToLeft).Column For i = 2 To EndRow
Key = CStr(.Cells(i, 1).Value)
dStd(Key) = Array(CStr(.Cells(i, 1).Value), CStr(.Cells(i, 2).Text), CStr(.Cells(i, 3).Text))
For J = 1 To EndCol
If .Cells(1, J).Text Like "*排" Then
dSbj(.Cells(1, J).Text) = ""
End If Key = CStr(.Cells(i, 1).Value) & ";" & em(n) & .Cells(1, J).Text
'Debug.Print Key
dRank(Key) = .Cells(i, J).Value Next J
Next i
End With
Next n For Each K In dSbj.Keys
Set sht = CreateSheet(ThisWorkbook, K & "_飞跃进步_我^_^了")
With sht
.Range("a1").Resize(1, 6).Value = Array("考号", "姓名", "班级", em(0), em(1), "进退")
EndCol = .Cells(1, .Cells.Columns.Count).End(xlToLeft).Column i = 1
For Each std In dStd.Keys
i = i + 1
Ar = dStd(std)
.Cells(i, 1).Value = Ar(0)
.Cells(i, 2).Value = Ar(1)
.Cells(i, 3).Value = Ar(2) Key = CStr(Ar(0)) & ";" & .Cells(1, 4).Text & Split(.Name, "_")(0)
.Cells(i, 4).Value = dRank(Key)
Key = CStr(Ar(0)) & ";" & .Cells(1, 5).Text & Split(.Name, "_")(0)
.Cells(i, 5).Value = dRank(Key)
.Cells(i, 6) = Val(.Cells(i, 4).Value) - Val(.Cells(i, 5).Value) Next std Sort_Rank .UsedRange, True
.Columns.AutoFit
End With
Next K Set dSbj = Nothing
Set dStd = Nothing
Set dRank = Nothing End Sub
Public Sub Sort_ClassRank(ByVal Rng As Range, Optional WithHeader As Boolean = True)
With Rng
.Sort _
Key1:=Rng.Cells(1, 3), Order1:=xlAscending, _
Key2:=Rng.Cells(1, 6), Order2:=xlDescending, _
Header:=IIf(WithHeader, xlYes, xlNo), MatchCase:=False, Orientation:=xlTopToBottom, SortMethod:=xlPinYin
End With
End Sub
Public Sub Sort_Rank(ByVal Rng As Range, Optional WithHeader As Boolean = True)
With Rng
.Sort _
Key1:=Rng.Cells(1, 6), Order1:=xlDescending, _
Header:=IIf(WithHeader, xlYes, xlNo), MatchCase:=False, Orientation:=xlTopToBottom, SortMethod:=xlPinYin
End With
End Sub

  

最新文章

  1. Spring RabbitMq
  2. 关于cookie
  3. [科普贴]为何Flash被淘汰?附Chrome看视频最完美教程!
  4. STM32的优先级NVIC_PriorityGroupConfig的理解及其使用
  5. MES项目中出现的一个事务嵌套的使用场景
  6. python之sys模块
  7. linux定时任务1-crontab命令
  8. 外部函数接口 LibFFI
  9. Android开发之去掉标题栏的三种方法,推荐第三种
  10. Bind和Eval的区别详解
  11. TCP滑动窗口控制流量的原理
  12. jsvc 以daemon方式运行tomcat
  13. Storm常见问题处理
  14. Macbook怎么强制关闭后台程序?Macbook强制关闭后台程序的方法
  15. Django之Model组件
  16. koa2--delegates模块源码解读
  17. Ubuntu 16.04安装httpd
  18. 2019-1-18 Spark 机器学习
  19. (网页)bootstrap模态框手动关闭(转)
  20. Mathmatica简介

热门文章

  1. topcoder srm 360 div1
  2. C# 字典常用方法
  3. 打造性感好用的 VS Code 编辑器
  4. What is the difference between visibility:hidden and display:none?
  5. MPU6050可以读取ID值,温度值和原始数据值为零问题解决
  6. POJ 1426 Find The Multiple(寻找倍数)
  7. HDU 4315 Climbing the Hill(阶梯博弈)
  8. springboot整合druid数据库连接池并开启监控
  9. git代码回滚的两种选择
  10. jquery 封装页面之间获取值