Buona sera a tutti,
Grazie alle indicazioni ricevute su questo forum sono riuscito a scrivere il codice taggato qui sotto.
Purtroppo la prima parte funziona bene, ma non riesco ad includere un altro loop per for n / next, ne a sommarne i valori nell'array tot.
Grazie in anticipo per ogni consiglio e spero aver taggato correttamente il codice.
Con i migliori saluti, lost



codice:
Sub VBA_short() '   ' Dim D1, D2 As Date   Dim clock As String   D1 = Time       Dim myArray As Variant     Dim bigArray As Variant     Dim sevarray As Variant     Dim smallarray(1 To 50000, 2) As Variant     Dim x As Long, j As Long, i As Long, n As Long             myArray = Worksheets("Sheet1").Range("A1:cv20000").Value       ReDim bigArray(1 To UBound(myArray, 1) * UBound(myArray, 2))       For x = 1 To UBound(myArray, 1)           For j = 1 To UBound(myArray, 2)               freq = myArray(x, j)                             For n = 1 To freq                                 sev = Exp(Application.WorksheetFunction.NormInv(Rnd(), 6.2146, 1.3204))                                                 sevarray(myArray(x, j), n) = sev                   Next n                                                  With Application.WorksheetFunction                 tot = .Sum(.Index(sevarray, myArray(x, j), 0))                 End With                                    i = i + 1                               bigArray(i) = tot           Next j       Next x       For col = 1 To 20   smallcounter = 1   For i = 1 + ((col - 1) * 50000) To col * 50000   smallarray(smallcounter, 0) = i   smallarray(smallcounter, 1) = bigArray(i)   smallcounter = smallcounter + 1   Next i   Range("data").Resize(50000, 2).Offset(0, (col - 1) * 3).Value = smallarray   Next col     D2 = Time   clock = Format(D2 - D1, "hh:mm:ss")   MsgBox "clock: " & clock