Hello.
I have some problem in the userform. In order to not represent whole userform code, I represented that problem "invalid procedure call" in a small macros.
Here we go
Sub test()
Dim hhh, n, c, s1, nr(), g5
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 IsEmpty(nr) Then
    g5 = Application.Average(nr)
    Debug.Print Join(nr, " ")
    Debug.Print g5
    End If
End Sub
The problem is that if nr is empty it nevertheless calculates g5 and I got the error on that line.
How to stop the calcalation of if condition of g5 in case of hhh="something" not "yes"?