title: VBA error handling if string not found in column
body: <p>I have code looking for "Model" in a column in excel but sometimes the work "Model" will not be there. Is there a way to error handle this? Basically I want it to say "if Model is not there then do xxx"</p>
  
  <pre><code>bNotModelType = True
  checking_type = "ModelType"
  Do While bNotModelType
      If Cells(j, 1).Value = checking_type Then
          Model_Type_Row = j
          bNotModelType = False
      End If
      j = j + 1
      If Model_Type_Row = Nothing Then
          MsgBox ("NADA")
  Loop
  </code></pre>
  
  <p>I have an incorrect use of Nothing</p>
  
  <p>UPDATE:</p>
  
  <p>I ended up using:</p>
  
  <pre><code>lastPossibleRow = 1000000
  
  lastRoww = ActiveSheet.Range("A" &amp; lastPossibleRow).End(xlUp).Row
  j = 1
  
  bNotModelType = True
  checking_type = "ModelType"
  Do While bNotModelType And j &lt; lastRoww
  
      If Cells(j, 1).Value = checking_type Then
          Model_Type_Row = j
          bNotModelType = False
      Else
      j = j + 1
  
      End If
  Loop
  
      If Model_Type_Row = 0 Then
          'do something
      Else
          'code for if modeltype was found in the excel document
      End If
  </code></pre>
  
  <p>I added in finding the last row because excel was running out of memory</p>