title: Find and Replace in Excel file using VB.NET, based on Excell value
body: <p>I am trying to use vb.net to loop through an Excel spreadsheet to do a find and replace. Additionally I need to do this find and replace based on the value of another cell.</p>
  
  <p>The code I have tried is:</p>
  
  <pre><code>    'loop through each row
      For X As Integer = 1 To 1000
          'check if the cell value matches the search string.
          If xlWorkSheet.Cells(X, 9).value = "Removed" And xlWorkSheet.Cells(X, 10).value = "Dispute" Then
              xlWorkSheet.Cells(X, 10).Replace("Dispute", "I have been replaced")
          End If
      Next
  </code></pre>
  
  <p>My issue is that ALL values of "Dispute" in column J (10) in the Excel file are being updated, whereas I would like it to only update "Dispute" to "I have been replaced". if the value of "Removed" is in Column I (9)</p>
  
  <p>Any help greatly appreciated</p>