title: Error within If Not IsError function without returning Else
body: <p>Post has been <strong>Updated</strong> below original post</p>
  
  <p>I am working with two tables and want to have them connected however, the first section contains more values than the second one. I was able to work that out by adding an <code>IfError</code> within the <code>Evaluate</code> function, seen from code example (1) to (2), (using help from <a href="https://stackoverflow.com/questions/26066575/if-error-then-blank">If Error Then Blank</a>)</p>
  
  <p>(1)</p>
  
  <pre><code>Worksheets("Sheet1").Range("Cell1").Value = Worksheets("Sheet1").Evaluate("=INDEX(data,MATCH(value,lookup_column,FALSE),column)") 
  </code></pre>
  
  <p>(2)</p>
  
  <pre><code>Worksheets("Sheet1").Range("Cell1").Value = Worksheets("Sheet1").Evaluate("=INDEX(data,MATCH(value,lookup_column,FALSE),column), Cell2")
  </code></pre>
  
  <p>However, I still would like a message saying that there was an error so I tried </p>
  
  <pre><code>Sub Name()
      Application.ScreenUpdating = False
      On Error GoTo Msg
  
      Worksheets("Sheet1").Range("Cell1").Value = Worksheets("Sheet1").Evaluate("=INDEX(data,MATCH(value,lookup_column,FALSE),column), Cell2")
  
      Worksheets("Sheet1").Range("Cell1").Value = Worksheets("Sheet1").Evaluate("=INDEX(data,MATCH(value,lookup_column,FALSE),column)")
  
      Exit Sub
  Msg:         MsgBox "You've had a fatal error"
      End
  
  End Sub
  </code></pre>
  
  <p>It did not return a message, I am assuming this is because the code for VBA was written correctly and it was the Excel function code that had an error. So is there a way to use another function to determine the excel error? </p>
  
  <p>This is a sub part of a larger coding so I know it is something that can be done in excel stand alone, but this is just a minor part of the whole. Thanks in advance.</p>
  
  <p><strong>UDATE</strong>:</p>
  
  <p>With comments I was able remove the Evaluate function and replace the original code with the following:</p>
  
  <pre><code>Sub SetWaterfall ()
  
  Application.ScreenUpdating = False
  
  
   Dim vMatchVal As Variant
  
  If Not IsError(vMatchVal) Then
  
  vMatchVal = Application.Match(Sheets("Sheet1").Range("SelectLine"), Sheets("Sheet1").Range("AS8:AS34"), 0)
  
  
  Worksheets("Sheet1").Range("AW45").Value = Application.Index(Sheets("Controls").Range("AR8:AR34"), vMatchVal)
  
  Else
  Worksheets("Controls").Range("AW45").Value = "Not Data"
  
  MsgBox "First number not found"
  End If
  
  
  End Sub
  </code></pre>
  
  <p>The issue is still that the index/match functions returns a <code>#NA</code> error and the message box never appears.  </p>
  
  <p>(Help converting Index/Match function from Excel formula to VBA code <a href="https://www.mrexcel.com/forum/excel-questions/691904-translate-index-match-function-vba-code.html" rel="nofollow noreferrer">https://www.mrexcel.com/forum/excel-questions/691904-translate-index-match-function-vba-code.html</a>)</p>
  
  <p>(If this edit process is not the correct procedure for let me know and I'll close the post)</p>