title: Is any way to make this VBA code to find next same value if there are more than one?
body: <p>I am a beginner on vba, sarching and reading different things about vba I have created a piece of code but doesn't work how I want to. If I search for a specific value the code find it and show on specific textboxes a specific value, but if there are more than one same values (in searching column) I want to make the code go to next one until find every same value, what my actual code doesn't do. Any help on improving this code or any other code that does it I appreciate.</p>
  <p>Here is my code,</p>
  <pre><code>Private Sub Search_Click()
  
  Dim a As String
  Dim b As Double
  Dim k As Range
  
  On Error GoTo dontexist:
  
  If Me.TextBox20.Value = &quot;&quot; Or Me.TextBox20.Value = &quot;Number of invoice&quot; Then
  
      Me.Label29.Caption = &quot;Number of invoice&quot;
  
      b = Me.TextBox24.Value
  
      Set k = Sheets(&quot;Sheet2&quot;).Range(&quot;E:E&quot;)
  
      r = Application.WorksheetFunction.Match(b, k, 0)
  
      Me.TextBox21.Value = Sheets(&quot;Sheet2&quot;).Cells(r, 2).Value
      Me.TextBox22.Value = Sheets(&quot;Sheet2&quot;).Cells(r, 8).Value
      Me.TextBox23.Value = Sheets(&quot;Sheet2&quot;).Cells(r, 4).Value
      Exit Sub
  
  Else
  
      Me.Label29.Caption = &quot;Sum of invoice&quot;
  
      a = Me.TextBox20.Value
  
      Set k = Sheets(&quot;Sheet2&quot;).Range(&quot;H:H&quot;)
  
      r = Application.WorksheetFunction.Match(a, k, 0)
  
      Me.TextBox21.Value = Sheets(&quot;Sheet2&quot;).Cells(r, 2).Value
      Me.TextBox22.Value = Sheets(&quot;Sheet2&quot;).Cells(r, 5).Value
      Me.TextBox23.Value = Sheets(&quot;Sheet2&quot;).Cells(r, 4).Value
  Exit Sub
  
  End If
  
  dontexist:
  
      MsgBox &quot;This record dosn't exist!&quot;, vbInformation, &quot;Info!&quot;
  
  End Sub
  </code></pre>