|
Private Sub 记录成绩_Click()
MsgBox "请您为" & Cells(1, 2) & "同学的表现打分", vbOKOnly, "相知_相遇 QQ:280027432"
m = InputBox("优4(分) 良3(分) 合格2(分) 不合格1(分)", "相知_相遇 QQ:280027432")
If MsgBox("是否保存记录", vbQuestion + vbYesNo, "相知_相遇 QQ:280027432") = vbYes Then
n = Sheets("随机点名").Cells(14, 3).Value
x = Sheets("随机点名").Cells(14, 1).Value
y = Sheets("随机点名").Cells(15, 2).Value
Sheets("随机点名").Range("A1:B9").Select
Selection.Copy
Sheets("点名记录").Select
Sheets("点名记录").Range("G1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("点名记录").Range("G1:H1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("点名记录").Cells(n, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("点名记录").Cells(n, 1).Select
ActiveCell.FormulaR1C1 = "=NOW()"
Sheets("点名记录").Cells(n, 4).Value = m
Sheets("点名记录").Cells(n, 5).Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-1]="""","""",IF(RC[-1]=4,""优"",IF(RC[-1]=3,""良"",IF(RC[-1]=2,""合格"",IF(RC[-1]=1,""不合格"")))))"
Sheets("点名记录").Range("A2:E2").Select
Sheets("点名记录").Range(Sheets("点名记录").Cells(n, 1), Sheets("点名记录").Cells(n, 5)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("名单").Cells(x, y + 2).Value = m
If MsgBox("已成功记录。是否返回随机点名?", vbQuestion + vbYesNo, "相知_相遇 QQ:280027432") = vbYes Then
Sheets("随机点名").Select
Sheets("随机点名").Cells(1, 4).Select
End If
End If
End Sub
Private Sub 清空_Click()
If MsgBox("您确定要清空点名记录吗?", vbQuestion + vbYesNo, "相知_相遇 QQ:280027432") = vbYes Then
Sheets("点名记录").Select
Sheets("点名记录").Range("A2:E65536").Select
Selection.ClearContents
Sheets("名单").Select
Sheets("名单").Range("C2:L65536").Select
Selection.ClearContents
Sheets("随机点名").Select
Sheets("随机点名").Range("B1").Select
End If
End Sub
Private Sub 随机点名_Click()
Cells(14, 1).Select
ActiveCell.FormulaR1C1 = "=INT(RAND()*(COUNTA(名单!C)-1)+2)"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
For i = 1 To 100000000
x = Cells(14, 2).Value
y = Cells(15, 2).Value
If x >= y Then
Cells(14, 1).Select
ActiveCell.FormulaR1C1 = "=INT(RAND()*(COUNTA(名单!C)-1)+2)"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End If
If x < y Then
Exit For
End If
Next
Cells(1, 2).Select
End Sub |
评分
-
1
查看全部评分
-
|