I have some code that I don't want to execute if the value in a particular cell is not calculated due to missing data and has the #NUM! in the cell. How do I test for this condition in VBA? The code I'me trying to use is below and the #NUM! is in cell D40

Private Sub CommandButton2_Click()
    If IsNumeric("D40") Then
        MsgBox "Please fill in more values"
        Exit Sub
    Else
        If Range("D7").Value = "" Then
            Range("D7").Value = "1"
            Range("D40").GoalSeek Goal:=0.1195, ChangingCell:=Range("D7")
       End If
    End If
    
End Sub