Tugas Mahasiswa

Buat data dasar menggunakan VBA Excel

Dipublikasikan pada : 29 Januari 2020.

Private Sub CommandButton1_Click()
UserForm1.Show
baris = Cells(Rows.Count, “D”).End(xlUp).Row
Range(“A3:D” & baris).Interior.Color = vbWhite
End Sub

Private Sub CommandButton2_Click()
UserForm2.Show
End Sub

Private Sub CommandButton3_Click()
Dim lembar1 As Worksheet
Set lembar1 = Worksheets(“Sheet1”)
akhir1 = lembar1.Cells(lembar1.Rows.Count, “C”).End(xlUp).Row
lembar1.Range(“B2:D” & akhir1).Sort Key1:=Range(“c2”), Order1:=xlAscending, Header:=xlYes

End Sub

Private Sub CommandButton4_Click()

End Sub

Private Sub CommandButton5_Click()
UserForm3.Show
End Sub

Private Sub CommandButton6_Click()
baris = Cells(Rows.Count, “A”).End(xlUp).Row
With Range(“B” & baris + 1 & “:C” & baris + 1)
.Merge
.Value = “Jumlah”
.Font.Bold = True
.Font.Color = vbBlue
.HorizontalAlignment = xlCenter
End With
With Range(“B” & baris + 2 & “:C” & baris + 2)
.Merge
.Value = “Rata-Rata”
.Font.Bold = True
.Font.Color = vbBlue
.HorizontalAlignment = xlCenter
End With
With Range(“B” & baris + 3 & “:C” & baris + 3)
.Merge
.Value = “Standar Deviasi”
.Font.Bold = True
.Font.Color = vbBlue
.HorizontalAlignment = xlCenter
End With
Range(“D” & baris + 1) = Application.WorksheetFunction.Sum(Range(“D3:D” & baris))
Range(“D” & baris + 2) = Application.WorksheetFunction.Average(Range(“D3:D” & baris))
Range(“D” & baris + 3) = Application.WorksheetFunction.StDev(Range(“D3:D” & baris))

End Sub