title: How to keep maximum values in a row and delete the rest?
body: <p>I am struggling with a dull work assignment where I am asked to locate the highest value in a row and delete the rest.</p>
  
  <p>The table in question:</p>
  
  <p><a href="https://i.stack.imgur.com/LJMaW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LJMaW.png" alt="enter image description here"></a></p>
  
  <p>For the shown table I want to find the highest market share for a product and keep only this value. I have tried numerous times with WorksheetFunction.Max, but the function only locates one of the highest values. In the table, row 1 for example we can see that the product has two equal max values. I want to keep them both and remove the others.</p>
  
  <p>Any help appreciated. Thanks for your time! :)</p>
  
  <p>EDIT:</p>
  
  <p>This is what I have managed to do as code: </p>
  
  <pre><code>Sub products()    
  
  Dim row As Integer
  Dim highest As Double
  Dim start As Integer
  Dim final As Integer
  Dim v As range
  
  start = 4
  final = Worksheets("Sheet1").CurrentRegion.Rows.Count
  
  For row = start To final
      Set v= Sheets("Sheet1").Rows(row)
      If WorksheetFunction.CountA(v) = 0 Then
          MsgBox "Row " &amp; row &amp; " has an empty cell.."
      Else
          highest = WorksheetFunction.Max(v)
      End If
      If v &lt; highest Then
          v.Value = ""
      End If
  Next row
  End Sub
  </code></pre>
  
  <p>It gives error on the last if statement. No idea why.</p>