0
我想在VBA中执行统计函数,但我已经跑到了墙上。你已经看到了一切设置。平均功能正常工作,但其他人失败。任何帮助将是惊人的!在VBA中执行统计函数
Private Sub CommandButton1_Click()
Dim Counter As Integer
Dim Count
Dim Total As Integer
Dim Average As Integer
Dim Std_Dev As Integer
Dim Max As Integer
Dim Min As Integer
Dim Median As Integer
With ListBox1
For Counter = 0 To .ListCount - 1
If .Selected(Counter) Then
Count = Count + 1
Total = Total + .List(Counter)
End If
Next Counter
End With
Average = (Total/Count)
'Std_Dev = Application.WorksheetFunction.StDev_S()
Max = Application.WorksheetFunction.Max(ListBox1.ListCount)
'Min = Application.WorksheetFunction.Min()
'Median = Application.WorksheetFunction.Median()
Unload Me
MsgBox "Test. " & Std_Dev
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
For Each cell In Range("Scores")
ListBox1.AddItem cell.Value
Next
End Sub
我不能非常感谢你!我为此工作了6个多小时,但无法弄清楚。你从字面上来说是一种拯救生命! – Anonymity21
不客气 – user3598756