title: Catching an out of range exception for a particular variable in C#
body: <p>In the code below I read through a smartsheet from column to column running some code until it throws an outofrange exception whereby I make the cellNumber = 0, and increase the row number (in other words move to a new line).</p>
  
  <pre><code>while (rowNumber &lt; totalRows)
  {
     try
     {
          do code....
          cellNumber++
     } catch (System.ArgumentOutOfRangeException)
     {
     cellNumber = 0;
     rowNumber++;
     }
  }
  </code></pre>
  
  <p>Is there anyway to only catch the out of range exception associated with cellNumber? </p>