Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50165

Test for #NUM! in cell

$
0
0
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

Code:

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


Viewing all articles
Browse latest Browse all 50165

Trending Articles