20171104xlVBA各人各科进退
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各人各科进退的更多相关文章
- 20171104xlVBA进退比较
Sub 比对两次成绩() CreateAdvance "进退比较", "月考2", "期中考", "月考2", &quo ...
- 第三十 访问财富进退自如 —Spring交易管理
6月16日本,明确. "应该留给追穷寇勇,不可沽名学霸王.天若有情天亦老,人间正道是沧桑." 有始有终.有往有还.进退自如乃Spring事务管理之道,也是万物生生不息.和谐共处之道 ...
- 写sql语句统计各个学生各科成绩(case when用法)
尊重原创:http://blog.csdn.net/love_java_cc/article/details/78268326 有如下一张表score: 建表语句: CREATE TABLE `sco ...
- mySQL--找出各科最高成绩
//找出各科最高成绩create table gradeMax(id int primary key auto_increment,name varchar(20),subject varchar(2 ...
- 20171104xlVBA制作联合成绩条
Dim dGoal As Object Dim dCls As Object Sub 制作联合成绩条() Dim sht As Worksheet Dim HeadRng As Range Dim H ...
- 查询各科成绩最高和最低的分:以如下形式显示:课程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 = ...
- sql语句查询成绩表各科前三名
--语法形式: ROW_NUMBER() OVER(PARTITION BY COL1 ORDER BY COL2) --解释: 根据COL1分组,在分组内部根据 COL2排序,而此函数计算的值就表示 ...
- <老友记>学习笔记
这是六个人的故事,从不服输而又有强烈控制欲的monica,未经世事的千金大小姐rachel,正直又专情的ross,幽默风趣的chandle,古怪迷人的phoebe,花心天真的joey——六个好友之间的 ...
- SQL Server2016升级前几点自检
SQL Server2016已经出来一段时间了,而且最新的SP1包也于2016年11月18日正式发布,各种新的特性推出让我们跃跃欲试.那么对于我们真实的业务环境,特别是生产环境要不要"跟风& ...
随机推荐
- java调用ws服务
1.找到ws服务地址,例如:http://www.webxml.com.cn/WebServices/MobileCodeWS.asmx 2.新建项目 3.进入命令行窗口,进入当前项目src目录下,然 ...
- Bootstrap3基础 img-responsive 响应式图片
内容 参数 OS Windows 10 x64 browser Firefox 65.0.2 framework Bootstrap 3.3.7 editor ...
- shell脚本中如何实现scp传输?
示例脚本如下: #! /bin/sh expect -c " spawn scp -r /home/jello/jello.txt jello@110.110.110.110:/home/j ...
- 题解——code[vs] 1506 传话(传递闭包)
裸的传递闭包 直接Floyd暴力即可 #include <cstdio> #include <algorithm> #include <cstring> using ...
- (转) How a Kalman filter works, in pictures
How a Kalman filter works, in pictures I have to tell you about the Kalman filter, because what it d ...
- WEB安全学习二、注入工具 sqlmap的使用
使用的是Kali Linux 系统,系统中默认的sqlmap 是安装好了的,电脑上没有安装sqlmap,自己百度 ,需要python的环境 使用 命令 sqlmap -h 可以查看 sqlm ...
- mybatis结合mysql批量操作及查询sql
MySQL数据库 批量操作主要使用的是Mybatis的foreach,遍历参数列表执行相应的操作,所以批量插入/更新/删除的写法是类似的,只是SQL略有区别而已.MySql批量操作需要数据库连接配置a ...
- 《算法竞赛入门经典》刘汝佳 C语言部分(前四章)“注解与习题” 之思索 -<1>
此书我购于去年的十一月份,也是经前人推荐购买的一本比较有用的书籍,在寒假自学此书,其简洁清晰高效的示例代码令我印象深刻,于是我打算把这本书的前四章后面的注解与习题(未给出标准解答)认真的去思索和研究, ...
- 从命令行git转到Tortoise
阅读前请注意:本文先学命令行git的,但过不久遇到乱码问题久久不能解决,最后转向tgit. 2016-29 安装 next 下一步 设置目录 勾选需要的项: Additional icons是关于图标 ...
- Linux安装Broadcom无线驱动
参考https://blog.csdn.net/u012833250/article/details/52493806 首先查看自己的网卡型号,然后先执行sudo apt-get update 再根据 ...