How about this
Sub test() Dim hhh, n, c, s1, nr(), g5, h hhh = "yes1" n = 10 c = 5 s1 = 15 Select Case hhh Case "no" Case "yes" For h = 1 To s1 ReDim Preserve nr(1 To s1) nr(h) = n - c Next h End Select If Not Not nr Then g5 = Application.Average(nr) Debug.Print Join(nr, " ") Debug.Print g5 End If End Sub