Контрольная работа: Бази даних в Excel, Access з викликами на VBA
Worksheets("ZVBA").Cells(9, 8).Formula = "=Sum(G2:G9)"
Worksheets("ZVBA").Cells(16, 8).Formula = "=Sum(G10:G16)"
Worksheets("ZVBA").Cells(21, 8).Formula = "=Sum(G17:G21)"
Worksheets("ZVBA").Cells(22, 8).Formula = "=Sum(H2:H21)"
End Sub
Private Sub CommandButton2_Click()
Worksheets("ZVBA").Range("A2:G21").Sort _
Key1:=Worksheets("ZVBA").Range("E1")
End Sub
Private Sub CommandButton3_Click()
Worksheets("ZVBA").Range("A2:G21").Sort _
Key1:=Worksheets("ZVBA").Range("A1")
End Sub
Private Sub CommandButton4_Click()
Set myRange = Worksheets("ZVBA").Range("C2:C9")
a = Application.WorksheetFunction.Count(myRange)
MsgBox a
End Sub
Private Sub CommandButton5_Click()
Worksheets("ZVBA").Range("A2:G21").Sort _
Key1:=Worksheets("ZVBA").Range("G1")
a = Cells(2, 5)
MsgBox a
End Sub
Private Sub CommandButton6_Click()
ThisWorkbook.Saved = True
ThisWorkbook.Close
End Sub
Висновок