各位論壇的先進大家好!不好意思。小弟又來請教大家問題了。這次的構想是『自動選擇評語系統』,當然這只是測試的性質,最後還是要由使用者也就是教師來選擇真正適合學生的評語。這語法會將老師所給的平時分數,挑選出預設的評語,語法如下:
Option Explicit
Sub 自動評語系統()
Dim a1, a2, a3, a4, a5 As String
Dim myrange, z, x1
a1 = "品學兼優"
a2 = "奮發向上"
a3 = "聰明伶俐"
a4 = "主動求知"
a5 = "各科均優"
z = 5
For x1 = 1 To z
Set myrange = Sheets("sheet1").Range("c" & x1)
Select Case myrange
Case 90 To 99
Sheets("sheet1").Range("c" & x1) = " a" & (Int(Rnd() * 5 + 1))
End Select
Next x1
End Sub