IFを適用することは可能ですか..それからVBAの配列に? 私は次のコードを持っており、配列プラガに For Each と If を適用しています - 各 Interval の出現回数をカウントしますが、VBA は「範囲外の添え字」を返します。 .
Option Explicit
Public plaga As Variant
Sub dort()
Dim cMin As Double
Dim cMax As Double
Dim lDer As Long
Dim plaga() As Variant
plaga = Worksheets("Sheet3").Range("A1:A10").Value
Call tri1(plaga)
cMin = WorksheetFunction.Min(plaga)
cMax = WorksheetFunction.Max(plaga)
Dim longInter As Double
longInter = (cMax - cMin) / 3
Dim pla As Variant
Dim lCom As Long
lDer = 2
For Each pla In plaga
If pla < cMin + longInter Then
lCom = 1
Else
For lCom = lDer To 3
If pla < cMin + longInter * lCom Then
lDer = lCom
Exit For
End If
Next
End If
plaga(lCom) = plaga(lCom) + 1
Next
Dim Destination As Range
Set Destination = Worksheets("Sheet3").Range("B1")
Destination.Resize(3, 1).Value = plaga
End Sub