動作している VBA 関数が与えられましたが、それがどのように機能するのかわかりません。助けていただければ幸いです。なぜなら、それが書かれた方法では、計算が非常に長いからです (基本的な算術 * 15 000 行)
私の問題は、次のように定義されている Double 変数 Qty_Level の定義から来ています。
Dim Qty_Level(30) As Double
関数のようにいくつかの括弧を使用して、このように定義された変数を見たことがありません。これが私のコードです:
Sub cumul()
Dim i As Long
Dim j As Integer
Dim Qty_level(30) As Double
Dim Col_Niveau As Integer
Dim Col_Quantite As Integer
Dim Col_Resultat As Integer
i = InputBox("Veuillez indiquer le numéro de la première à analyser (numéro de ligne Excel)", "Ligne de départ")
Col_Niveau = InputBox("Veuillez indiquer le numéro de la colonne contenant les niveaux", "Niveaux")
Col_Quantite = InputBox("Veuillez indiquer le numéro de la colonne contenant les quantités", "Quantités")
Col_Resultat = InputBox("Veuillez indiquer le numéro de la colonne contenant les résultats", "Résultats")
Do While IsEmpty(Cells(i, Col_Niveau)) = False
If IsNumeric(Cells(i, Col_Quantite)) = True Then
Qty_level(Cells(i, Col_Niveau).Value) = Cells(i, Col_Quantite).Value
Cells(i, Col_Resultat).Value = 1
For j = 1 To Cells(i, Col_Niveau).Value
Cells(i, Col_Resultat).Value = Cells(i, Col_Resultat).Value * Qty_level(j)
Next j
End If
i = i + 1
Loop
End Sub
これがどのように機能するか、特にFor
ループがDouble(j)