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

  

20171104xlVBA各人各科进退的更多相关文章

  1. 20171104xlVBA进退比较

    Sub 比对两次成绩() CreateAdvance "进退比较", "月考2", "期中考", "月考2", &quo ...

  2. 第三十 访问财富进退自如 —Spring交易管理

    6月16日本,明确. "应该留给追穷寇勇,不可沽名学霸王.天若有情天亦老,人间正道是沧桑." 有始有终.有往有还.进退自如乃Spring事务管理之道,也是万物生生不息.和谐共处之道 ...

  3. 写sql语句统计各个学生各科成绩(case when用法)

    尊重原创:http://blog.csdn.net/love_java_cc/article/details/78268326 有如下一张表score: 建表语句: CREATE TABLE `sco ...

  4. mySQL--找出各科最高成绩

    //找出各科最高成绩create table gradeMax(id int primary key auto_increment,name varchar(20),subject varchar(2 ...

  5. 20171104xlVBA制作联合成绩条

    Dim dGoal As Object Dim dCls As Object Sub 制作联合成绩条() Dim sht As Worksheet Dim HeadRng As Range Dim H ...

  6. 查询各科成绩最高和最低的分:以如下形式显示:课程ID,最高分,最低分

    SELECT L.C# As 课程ID,L.score AS 最高分,R.score AS 最低分 FROM SC L ,SC AS R WHERE L.C# = R.C# and L.score = ...

  7. sql语句查询成绩表各科前三名

    --语法形式: ROW_NUMBER() OVER(PARTITION BY COL1 ORDER BY COL2) --解释: 根据COL1分组,在分组内部根据 COL2排序,而此函数计算的值就表示 ...

  8. <老友记>学习笔记

    这是六个人的故事,从不服输而又有强烈控制欲的monica,未经世事的千金大小姐rachel,正直又专情的ross,幽默风趣的chandle,古怪迷人的phoebe,花心天真的joey——六个好友之间的 ...

  9. SQL Server2016升级前几点自检

    SQL Server2016已经出来一段时间了,而且最新的SP1包也于2016年11月18日正式发布,各种新的特性推出让我们跃跃欲试.那么对于我们真实的业务环境,特别是生产环境要不要"跟风& ...

随机推荐

  1. BottomNavigationBar 底部导航控件

    BottomNavigationBar 底部导航控件 属性 说明BottomNavigationBarItem 多个 item,iconSize icon大小currentIndex 默认选中第几个o ...

  2. R语言之正则表达式

    常见与正则表达式相关的函数: grep(pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE, fixed = FALSE, use ...

  3. Matconvnet 的一些记录

    Matconvnet 的一些记录 Example code from ADNet: Action-Decision Networks for Visual Tracking with Deep Rei ...

  4. 给Ubuntu添加清华的软件源

    找到 sources.list 文件 cd /etc/apt/ 编辑 vim sources.list 在最后面加上下面这几条语句 # 默认注释了源码镜像以提高 apt update 速度,如有需要可 ...

  5. 几个优化SQL查询的方法

    1.什么是执行计划 执行计划是数据库根据SQL语句和相关表的统计信息作出的一个查询方案,这个方案是由查询优化器自动分析产生的,比如一条SQL语句如果用来从一个 10万条记录的表中查1条记录,那查询优化 ...

  6. kubernetes 实战2_命令_Configure Pods and Containers

    --以yaml格式输出:pod\configmap\service\ingress\deployment kubectl get pod platform-financeapi-deployment- ...

  7. 1、http协议基础及IO模型

    Nginx (web server,web reverse proxy): http协议:80/tcp,HyperText Transfer Procotol http协议版本: HTTP/0.9:原 ...

  8. Python: find the smallest and largest value

    题目要求: Write a program that repeatedly prompts a user for integer numbers until the user enters 'done ...

  9. HTML+CSS+JS 传智 详细笔记

    HTML(1)- -毕向东老师对Html的简介 CSS- -毕老师对CSS的简介 Javascript- -毕老师对JS的简介 html&css等等练习表(W3Cscholl) js练习表回顾 ...

  10. Bootstrap 固定导航条

    默认情况下,导航条的定位属性为 static,它的位置由它的HTML代码中定义的顺序出现,并随着页面向下滚动而消失.也可以改变它的定位方式,让它固定显示在浏览器窗口的顶部或底部. 1.固定在顶部 如果 ...