31 December 2015

Menentukan Nilai Huruf dan Keterangan Kelulusan dengan Excel Macro

Pembahasan kali ini mengenai Excel Macro yaitu untuk mencari Nilai Huruf dan Kelulusan, terdapat daftar nilai mahasiswa seperti berikut ini :



Langkah berikutnya yaitu membuat pemrograman Macro nya dengan Visual Basic :


Object Form
Propertie
Keterangan
Command1

Name
Value
CmdNilaiHuruf
NILAI HURUF
Command2

Name
Value
CmdKeterangan
KETERANGAN

Coding :

Private Sub CmdKeterangan_Click()
    For i = 2 To 9
        If Cells(i, 5) = "A" Or Cells(i, 5) = "B" Or Cells(i, 5) = "C" Then
            Cells(i, 6).Font.ColorIndex = 5
            Cells(i, 6) = "LULUS"
        ElseIf Cells(i, 5) = "D" Then
            Cells(i, 6).Font.ColorIndex = 4
            Cells(i, 6) = "MENGULANG"
        Else
            Cells(i, 6).Font.ColorIndex = 3
            Cells(i, 6) = "GAGAL"
        End If
    Next i
End Sub

Private Sub CmdNilaiHuruf_Click()
    For i = 2 To 9
        If Cells(i, 4) > 90 Then
            Cells(i, 5) = "A"
        ElseIf Cells(i, 4) >= 80 Then
            Cells(i, 5) = "B"
        ElseIf Cells(i, 4) >= 70 Then
            Cells(i, 5) = "C"
        ElseIf Cells(i, 4) >= 60 Then
            Cells(i, 5) = "D"
        Else
            Cells(i, 5) = "E"
        End If
    Next i
End Sub


Keterangan :
Font.ColorIndex = 3 => Warna Merah
Font.ColorIndex = 4 => Warna Hijau
Font.ColorIndex = 5 => Warna Biru

No comments:

Post a Comment