This example selects a range of data in column D and then calls CB.Fit in a For loop. The loop fits each distribution to the range of data, saving the best distribution index in bestdist and the corresponding Anderson-Darling p-value in bestfit.
CB.SetFitRange Range("D4:D104") For i = 0 To 23 Result = CB.Fit(i, cbFitAndersonDarling, True) If i = 0 Then bestfit = result Else If bestfit > result Then bestdist = i bestfit = result End If End If Next i