演習10 のユーザーフォーム コード


------ [UserForm1] -------
Private Sub Average_Click()
  Dim A As Single
  
  With Worksheets("Sheet1")
    A = Application.WorksheetFunction.Average(Range("B1:B10"))
    MsgBox "平均は " & A
  End With
End Sub


Private Sub Closed_Click()
  End
End Sub

Private Sub Stdev_Click()
  Dim D As Single
  
  With Worksheets("Sheet1")
    D = Application.WorksheetFunction.Stdev(Range("B1:B10"))
    MsgBox "標準偏差は " & D
  End With
End Sub

Private Sub Sum_Click()
  Dim S As Integer
  
  With Worksheets("Sheet1")
    S = Application.WorksheetFunction.Sum(Range("B1:B10"))
    MsgBox "合計は " & S
  End With
End Sub

                                                                   back top