Sub 頻度計算()
Dim myRng As Range
Dim myJ As Integer
Dim myDiv As Integer
Dim myCount As Integer
'分割数10
myDiv = 10
Set myRng = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
Application.ScreenUpdating = False
myRng.Sort Range("A1"), xlAscending, Header:=xlYes
Cells(1, 2) = "最小値"
myMin = Cells(1, 1)
Cells(2, 2) = myMin
Cells(3, 2) = "最大値"
myMax = Cells(Rows.Count, 1).End(xlUp)
Cells(4, 2) = myMax
Cells(5, 2) = "分割数"
Cells(6, 2) = myDiv
Cells(7, 2) = "刻み幅"
myJ = Round((myMax - myMin) / myDiv)
Cells(8, 2) = myJ
myComp = Round(myMin) + myJ * (n - 1)
myCount = 1
mytemp = 0
myEnd = Cells(Rows.Count, 1).End(xlUp).Row
For n = 1 To myEnd
If myComp < Cells(n, 1) Then
myComp = myComp + myJ
Cells(myCount, 3) = myComp - myJ / 2
Cells(myCount, 4) = n - mytemp
mytemp = n
myCount = myCount + 1
End If
Next
Application.ScreenUpdating = True
End Sub
0 件のコメント:
コメントを投稿