0ooSunoo0
Thành viên mới
- Tham gia
- 17/6/21
- Bài viết
- 1
- Được thích
- 0
Sub Button1_Click()
Dim a As String, b As String, c As String, d As String, e As String, g As String, h As String
a = InputBox("STT")
Range("A13").Value = a
b = InputBox("MSSV")
Range("B13").Value = b
c = InputBox("Ho")
Range("C13").Value = c
d = InputBox("Ten")
Range("D13").Value = d
e = InputBox("Ngay sinh")
Range("E13").Value = e
g = InputBox("Lop")
Range("F13").Value = g
h = InputBox("DTB")
Range("G13").Value = h
End Sub
Sub Button2_Click()
Dim so As Integer
Dim dem As Integer
Dim i As Integer
For i = 13 To 2 Step -1
so = CInt(Sheets(11).Cells(i, 7).Value)
If (so >= 7) Then
dem = dem + 1
End If
Next i
If dem = 0 Then
MsgBox " Khong tim thay "
Else
MsgBox "So hoc sinh có DTB >= 7 la " & dem & ""
End If
End Sub
Sub Button5_Click()
Range("A2:H13").Interior.Color = vbWhite
Dim i As String
i = InputBox("Nhap trungbinh, kha, gioi de to mau xep loai")
If i = "trungbinh" Then
For Each cell In Range("H2:H13")
If cell.Value = "Trung Binh" Then
cell.Interior.Color = vbYellow
End If
Next
ElseIf i = "kha" Then
For Each cell In Range("H2:H13")
If cell.Value = "Kha" Then
cell.Interior.Color = vbGreen
End If
Next
ElseIf i = "gioi" Then
For Each cell In Range("H2:H13")
If cell.Value = "Gioi" Then
cell.Interior.Color = vbRed
End If
Next
End If
End Sub
Function XepLoai(DTB As Double) As String
If DTB >= 8 Then
XepLoai = "Gioi"
ElseIf DTB >= 7 And DTB < 8 Then
XepLoai = "Kha"
ElseIf DTB >= 5 And DTB < 7 Then
XepLoai = "Trung Binh"
Else
XepLoai = "Kem"
End If
End Function
Dim a As String, b As String, c As String, d As String, e As String, g As String, h As String
a = InputBox("STT")
Range("A13").Value = a
b = InputBox("MSSV")
Range("B13").Value = b
c = InputBox("Ho")
Range("C13").Value = c
d = InputBox("Ten")
Range("D13").Value = d
e = InputBox("Ngay sinh")
Range("E13").Value = e
g = InputBox("Lop")
Range("F13").Value = g
h = InputBox("DTB")
Range("G13").Value = h
End Sub
Sub Button2_Click()
Dim so As Integer
Dim dem As Integer
Dim i As Integer
For i = 13 To 2 Step -1
so = CInt(Sheets(11).Cells(i, 7).Value)
If (so >= 7) Then
dem = dem + 1
End If
Next i
If dem = 0 Then
MsgBox " Khong tim thay "
Else
MsgBox "So hoc sinh có DTB >= 7 la " & dem & ""
End If
End Sub
Sub Button5_Click()
Range("A2:H13").Interior.Color = vbWhite
Dim i As String
i = InputBox("Nhap trungbinh, kha, gioi de to mau xep loai")
If i = "trungbinh" Then
For Each cell In Range("H2:H13")
If cell.Value = "Trung Binh" Then
cell.Interior.Color = vbYellow
End If
Next
ElseIf i = "kha" Then
For Each cell In Range("H2:H13")
If cell.Value = "Kha" Then
cell.Interior.Color = vbGreen
End If
Next
ElseIf i = "gioi" Then
For Each cell In Range("H2:H13")
If cell.Value = "Gioi" Then
cell.Interior.Color = vbRed
End If
Next
End If
End Sub
Function XepLoai(DTB As Double) As String
If DTB >= 8 Then
XepLoai = "Gioi"
ElseIf DTB >= 7 And DTB < 8 Then
XepLoai = "Kha"
ElseIf DTB >= 5 And DTB < 7 Then
XepLoai = "Trung Binh"
Else
XepLoai = "Kem"
End If
End Function