学生期末评语自动生成器

曾经,有多少班主任为学生书写操行评语而大伤脑筋!有了评语自动生成器,一键搞定!利用学生在校期间的德育表现、学习成绩、综合评价等次等大数据,全方位立体式无死角地进行智能分析,依据分析结果对学生进行科学合理有效地评价。
在这个强大的神器背后,先要建立强大的评语库。


VBA代码

评语生成器代码
排名代码
Public Sub rank()
Dim rnk%, i%, j%
If bjrs = 0 Then
Sheets("等级评价表").Select
Do While Sheets("等级评价表").Cells(bjrs + 3, 1) <> ""
bjrs = bjrs + 1
Loop
End If
For i = 1 To bjrs
rnk = 1
For j = 1 To bjrs
If Sheets("等级评价表").Cells(i + 2, 3) < Sheets("等级评价表").Cells(j + 2, 3) Then rnk = rnk + 1
Next
Sheets("等级评价表").Cells(i + 2, 4) = rnk
Next
End Sub
等级代码
Public Sub degree()
If bjrs = 0 Then
Sheets("等级评价表").Select
Do While Sheets("等级评价表").Cells(bjrs + 3, 1) <> ""
bjrs = bjrs + 1
Loop
End If
For i = 1 To bjrs
Select Case Sheets("等级评价表").Cells(i + 2, 4)
Case Is <= Round(bjrs * 0.1)
Sheets("等级评价表").Cells(i + 2, 5) = "A"
Case Is <= Round(bjrs * 0.5)
Sheets("等级评价表").Cells(i + 2, 5) = "B"
Case Is <= Round(bjrs * 0.9)
Sheets("等级评价表").Cells(i + 2, 5) = "C"
Case Else
Sheets("等级评价表").Cells(i + 2, 5) = "D"
End Select
Next
End Sub
评语生成代码
Public Sub comment()
If Sheets("等级评价表").Cells(1, 1) = "" Then Sheets("等级评价表").Cells(1, 1) = "学生操行评语评价表"
If Sheets("等级评价表").Cells(2, 1) = "" Then Sheets("等级评价表").Cells(2, 1) = "姓名"
If Sheets("等级评价表").Cells(2, 2) = "" Then Sheets("等级评价表").Cells(2, 2) = "性别"
If Sheets("等级评价表").Cells(2, 3) = "" Then Sheets("等级评价表").Cells(2, 3) = "总分"
If Sheets("等级评价表").Cells(2, 4) = "" Then Sheets("等级评价表").Cells(2, 4) = "排名"
If Sheets("等级评价表").Cells(2, 5) = "" Then Sheets("等级评价表").Cells(2, 5) = "等级"
If Sheets("等级评价表").Cells(2, 6) = "" Then Sheets("等级评价表").Cells(2, 6) = "评语"
If bjrs = 0 Then
Sheets("等级评价表").Select
Do While Sheets("等级评价表").Cells(bjrs + 3, 1) <> ""
bjrs = bjrs + 1
Loop
End If
Sheets("等级评价表").Range(Cells(3, 4), Cells(bjrs + 2, 6)).ClearContents
Call rank
Call degree
Sheets("评语库").Visible = -1
Sheets("评语库").Cells.Interior.Pattern = xlNone
For i = 1 To 8
Sheets("评语库").Cells(1000, i) = 0
Next
ST = Now
Do While Now - ST <= TimeValue("00:00:05")
For i = 1 To bjrs
BB:
If Sheets("等级评价表").Cells(i + 2, 2) = "男" And Sheets("等级评价表").Cells(i + 2, 5) = "A" Then
pyts = 0
Do While Sheets("评语库").Cells(pyts + 1, 1) <> ""
pyts = pyts + 1
Loop
rw = Int(pyts * Rnd()) + 1
If Sheets("评语库").Cells(rw, 1).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(rw, 1)
Sheets("评语库").Cells(rw, 1).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 1) = Sheets("评语库").Cells(1000, 1) + 1
Else
If Sheets("评语库").Cells(1000, 1) < pyts Then
If Sheets("评语库").Cells(1000, 1) >= pyts / 2 Then
For j = 1 To pyts
If Sheets("评语库").Cells(j, 1).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(j, 1)
Sheets("评语库").Cells(j, 1).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 1) = Sheets("评语库").Cells(1000, 1) + 1
Exit For
End If
Next
Else
GoTo BB
End If
Else
Sheets("评语库").Columns(1).Interior.Pattern = xlNone
Sheets("评语库").Cells(1000, 1) = 0
GoTo BB
End If
End If
End If
If Sheets("等级评价表").Cells(i + 2, 2) = "男" And Sheets("等级评价表").Cells(i + 2, 5) = "B" Then
pyts = 0
Do While Sheets("评语库").Cells(pyts + 1, 2) <> ""
pyts = pyts + 1
Loop
rw = Int(pyts * Rnd()) + 1
If Sheets("评语库").Cells(rw, 2).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(rw, 2)
Sheets("评语库").Cells(rw, 2).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 2) = Sheets("评语库").Cells(1000, 2) + 1
Else
If Sheets("评语库").Cells(1000, 2) < pyts Then
If Sheets("评语库").Cells(1000, 2) >= pyts / 2 Then
For j = 1 To pyts
If Sheets("评语库").Cells(j, 2).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(j, 2)
Sheets("评语库").Cells(j, 2).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 2) = Sheets("评语库").Cells(1000, 2) + 1
Exit For
End If
Next
Else
GoTo BB
End If
Else
Sheets("评语库").Columns(2).Interior.Pattern = xlNone
Sheets("评语库").Cells(1000, 2) = 0
GoTo BB
End If
End If
End If
If Sheets("等级评价表").Cells(i + 2, 2) = "男" And Sheets("等级评价表").Cells(i + 2, 5) = "C" Then
pyts = 0
Do While Sheets("评语库").Cells(pyts + 1, 3) <> ""
pyts = pyts + 1
Loop
rw = Int(pyts * Rnd()) + 1
If Sheets("评语库").Cells(rw, 3).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(rw, 3)
Sheets("评语库").Cells(rw, 3).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 3) = Sheets("评语库").Cells(1000, 3) + 1
Else
If Sheets("评语库").Cells(1000, 3) < pyts Then
If Sheets("评语库").Cells(1000, 3) >= pyts / 2 Then
For j = 1 To pyts
If Sheets("评语库").Cells(j, 3).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(j, 3)
Sheets("评语库").Cells(j, 3).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 3) = Sheets("评语库").Cells(1000, 3) + 1
Exit For
End If
Next
Else
GoTo BB
End If
Else
Sheets("评语库").Columns(3).Interior.Pattern = xlNone
Sheets("评语库").Cells(1000, 3) = 0
GoTo BB
End If
End If
End If
If Sheets("等级评价表").Cells(i + 2, 2) = "男" And Sheets("等级评价表").Cells(i + 2, 5) = "D" Then
pyts = 0
Do While Sheets("评语库").Cells(pyts + 1, 4) <> ""
pyts = pyts + 1
Loop
rw = Int(pyts * Rnd()) + 1
If Sheets("评语库").Cells(rw, 4).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(rw, 4)
Sheets("评语库").Cells(rw, 4).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 4) = Sheets("评语库").Cells(1000, 4) + 1
Else
If Sheets("评语库").Cells(1000, 4) < pyts Then
If Sheets("评语库").Cells(1000, 4) >= pyts / 2 Then
For j = 1 To pyts
If Sheets("评语库").Cells(j, 4).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(j, 4)
Sheets("评语库").Cells(j, 4).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 4) = Sheets("评语库").Cells(1000, 4) + 1
Exit For
End If
Next
Else
GoTo BB
End If
Else
Sheets("评语库").Columns(4).Interior.Pattern = xlNone
Sheets("评语库").Cells(1000, 4) = 0
GoTo BB
End If
End If
End If
If Sheets("等级评价表").Cells(i + 2, 2) = "女" And Sheets("等级评价表").Cells(i + 2, 5) = "A" Then
pyts = 0
Do While Sheets("评语库").Cells(pyts + 1, 5) <> ""
pyts = pyts + 1
Loop
rw = Int(pyts * Rnd()) + 1
If Sheets("评语库").Cells(rw, 5).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(rw, 5)
Sheets("评语库").Cells(rw, 5).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 5) = Sheets("评语库").Cells(1000, 5) + 1
Else
If Sheets("评语库").Cells(1000, 5) < pyts Then
If Sheets("评语库").Cells(1000, 5) >= pyts / 2 Then
For j = 1 To pyts
If Sheets("评语库").Cells(j, 5).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(j, 5)
Sheets("评语库").Cells(j, 5).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 5) = Sheets("评语库").Cells(1000, 5) + 1
Exit For
End If
Next
Else
GoTo BB
End If
Else
Sheets("评语库").Columns(5).Interior.Pattern = xlNone
Sheets("评语库").Cells(1000, 5) = 0
GoTo BB
End If
End If
End If
If Sheets("等级评价表").Cells(i + 2, 2) = "女" And Sheets("等级评价表").Cells(i + 2, 5) = "B" Then
pyts = 0
Do While Sheets("评语库").Cells(pyts + 1, 6) <> ""
pyts = pyts + 1
Loop
rw = Int(pyts * Rnd()) + 1
If Sheets("评语库").Cells(rw, 6).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(rw, 6)
Sheets("评语库").Cells(rw, 6).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 6) = Sheets("评语库").Cells(1000, 6) + 1
Else
If Sheets("评语库").Cells(1000, 6) < pyts Then
If Sheets("评语库").Cells(1000, 6) >= pyts / 2 Then
For j = 1 To pyts
If Sheets("评语库").Cells(j, 6).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(j, 6)
Sheets("评语库").Cells(j, 6).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 6) = Sheets("评语库").Cells(1000, 6) + 1
Exit For
End If
Next
Else
GoTo BB
End If
Else
Sheets("评语库").Columns(6).Interior.Pattern = xlNone
Sheets("评语库").Cells(1000, 6) = 0
GoTo BB
End If
End If
End If
If Sheets("等级评价表").Cells(i + 2, 2) = "女" And Sheets("等级评价表").Cells(i + 2, 5) = "C" Then
pyts = 0
Do While Sheets("评语库").Cells(pyts + 1, 7) <> ""
pyts = pyts + 1
Loop
rw = Int(pyts * Rnd()) + 1
If Sheets("评语库").Cells(rw, 7).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(rw, 7)
Sheets("评语库").Cells(rw, 7).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 7) = Sheets("评语库").Cells(1000, 7) + 1
Else
If Sheets("评语库").Cells(1000, 7) < pyts Then
If Sheets("评语库").Cells(1000, 7) >= pyts / 2 Then
For j = 1 To pyts
If Sheets("评语库").Cells(j, 7).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 6) = Sheets("评语库").Cells(j, 7)
Sheets("评语库").Cells(j, 7).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 7) = Sheets("评语库").Cells(1000, 7) + 1
Exit For
End If
Next
Else
GoTo BB
End If
Else
Sheets("评语库").Columns(7).Interior.Pattern = xlNone
Sheets("评语库").Cells(1000, 7) = 0
GoTo BB
End If
End If
End If
If Sheets("等级评价表").Cells(i + 2, 2) = "女" And Sheets("等级评价表").Cells(i + 2, 5) = "D" Then
pyts = 0
Do While Sheets("评语库").Cells(pyts + 1, 8) <> ""
pyts = pyts + 1
Loop
rw = Int(pyts * Rnd()) + 1
If Sheets("评语库").Cells(rw, 8).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 8) = Sheets("评语库").Cells(rw, 8)
Sheets("评语库").Cells(rw, 8).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 8) = Sheets("评语库").Cells(1000, 8) + 1
Else
If Sheets("评语库").Cells(1000, 8) < pyts Then
If Sheets("评语库").Cells(1000, 8) >= pyts / 2 Then
For j = 1 To pyts
If Sheets("评语库").Cells(j, 8).Interior.Pattern = xlNone Then
Sheets("等级评价表").Cells(i + 2, 8) = Sheets("评语库").Cells(j, 8)
Sheets("评语库").Cells(j, 8).Interior.Color = RGB(255, 192, 203)
Sheets("评语库").Cells(1000, 8) = Sheets("评语库").Cells(1000, 8) + 1
Exit For
End If
Next
Else
GoTo BB
End If
Else
Sheets("评语库").Columns(8).Interior.Pattern = xlNone
Sheets("评语库").Cells(1000, 8) = 0
GoTo BB
End If
End If
End If
Next
Loop
Sheets("等级评价表").Range(Cells(3, 6), Cells(bjrs + 2, 6)).Select
With Selection
.Font.Size = 10
.RowHeight = 25
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.WrapText = True
End With
Sheets("评语库").Visible = 2
End Sub
代码写完后,在“等级评价表”中只需输入学生姓名、性别和总分三项数据,然后点击“一键生成评语”按钮,即可瞬间生成评语。

看看生成的评语表长啥样?

编程不易,且用且珍惜!
感谢观看
2023.01.10


