算績點,90--100磁區間的給4.5 然后再用4.5乘以學分
我沒能寫對
Private Sub CommandButton1_Click()
For i = Cells(6, 2) To Cells(7, 2)
Cells(i, Cells(8, 2)) = 0
Next i
For i = Cells(6, 2) To Cells(7, 2)
For j = Cells(9, 2) To Cells(10, 2)
If IsNumeric(Cells(i, j)) = True Then If Cells(i, j) >= 90& & Cells(i, j) <= 100 Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 4.5
If IsNumeric(Cells(i, j)) = True Then If Cells(i, j) >= 80& & Cells(i, j) < 90 Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 3.5
If IsNumeric(Cells(i, j)) = True Then If Cells(i, j) >= 70& & Cells(i, j) < 80 Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 2.5
If IsNumeric(Cells(i, j)) = True Then If Cells(i, j) >= 60& & Cells(i, j) < 70 Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 1.5
If IsNumeric(Cells(i, j)) = True Then If Cells(i, j) >= 0& & Cells(i, j) < 60 Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 0
If IsNumeric(Cells(i, j)) = False Then If Cells(i, j) = "不及格" Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 0
If IsNumeric(Cells(i, j)) = False Then If Cells(i, j) = "及格" Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 1.5
If IsNumeric(Cells(i, j)) = False Then If Cells(i, j) = "中" Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 2.5
If IsNumeric(Cells(i, j)) = False Then If Cells(i, j) = "良" Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 3.5
If IsNumeric(Cells(i, j)) = False Then If Cells(i, j) = "優" Then Cells(i, Cells(8, 2)) = Cells(i, Cells(8, 2)) + Cells(Cells(11, 2), j).Value = 4.5
Next j
Next i
End Sub
uj5u.com熱心網友回復:
在Excel中開始記錄宏,手動完成所需功能,結束記錄宏,按Alt+F11鍵,查看剛才記錄的宏對應的VBA代碼。uj5u.com熱心網友回復:
請參考:sub test
dim Rngs as range,Rng as range
set rngs=sheet1.range("a3:h33")'''
for each rng in rngs
select case val(rng.value)
case 90 to 100
rng.offset(0,1).value=https://bbs.csdn.net/topics/4.5*學分''''在后面一列對應位置
case else
select case rng.value
case "合格"
case "不及格"
case "優秀"
end select
end select
next
end sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/66974.html
標籤:VBA
上一篇:關于excel vba
下一篇:提示缺少串列分隔符或
