title: how to remove cell value in the cell offset if a new value with the same data repeated after that?
body: <p>I want to make a loop in range to zero the offset cell if the cell data is repeated next as below:</p>
  <pre><code>    Column A          Column B
      T10               5
      T20               10 
      T10               15
  </code></pre>
  <p>You see I have T10 Repeated maybe after one or many rows, What I want is to use only the last value for T10 (Which is 15 in this example) and make 5 = 0</p>
  <p>I use this code in vb.net</p>
  <pre><code>Private Sub AdjustTotalStoreWeightPerDiamater()
      wb = Workbook Path ...
      ws = Worksheet Name ...
      lr = last row
      Rng = Column Range
      Cel = Column Range
      i = integer
  
      With ws
          lr = .Range(&quot;A&quot; &amp; .Rows.Count).End(Excel.XlDirection.xlUp).Row
          Rng = ws.Range(&quot;A2&quot;, &quot;A&quot; &amp; lr)
      End With
  
      For i = 2 To lr
          For Each Cel In Rng.Cells
              If Cel.Value = Cel.Offset(-1, 0).Value Then
                  Cel.Offset(0, 3).Value = 0
              End If
         Next
      Next
  End Sub
  </code></pre>
  <p>But the code does not sense that T10 = T10 to make the change.</p>
  <p>Appreciate your support.</p>