title: Navigating through records on UserForm Excel VBA
body: <p>I have created a userform in Excel VBA, which I will use to view and update certain records from the sheet I have:</p>
  
  <p><a href="http://im35.gulfup.com/Ay43Z.png" rel="nofollow noreferrer">UserForm1 http://im35.gulfup.com/Ay43Z.png</a></p>
  
  <p>What I can't seem to figure out is how to make it Navigate between the records in the Sheet which have "Y" in the Status column.</p>
  
  <p><a href="http://im36.gulfup.com/cq6CN.png" rel="nofollow noreferrer">Sheet1 http://im36.gulfup.com/cq6CN.png</a></p>
  
  <p>I need the user to be able to edit the Comments column through the UserForm for the records he is viewing so that the changes are saved in the Sheet. The rest of the textboxes on the Userform are set to Locked so that they can only display data.</p>
  
  <p>The problem I'm facing now is that I can only seem to be able to loop between all the records. What I need is to navigate between the ones having "Y" as their "Status". Also, I can't seem to figure out how have the changes made in the Comments box on the form to be saved on the sheet.</p>
  
  <p>Any help would be really appreciated!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The below is the code I have for the Previous Button:</p>
  
  <pre><code>If CurRecord = 0 Then CurRecord = 1
  
      With ws
          For i = 1 To (CurRecord - 1)
              If Not .Range("G" &amp; i).Value = "X" Then
                  TextBox1.Text = .Range("A" &amp; i).Value
                  TextBox2.Text = .Range("B" &amp; i).Value
                  '
                  '~~&gt; And So on load the rest
                  '
  
                  CurRecord = i
                  Exit Sub
              End If
          Next i
  
          If (i - 1) = lRow Then
              MsgBox "End of record reached"
          End If
      End With
  </code></pre>
  
  <p>When I use this it keeps jumping to the first record.</p>
  
  <p>I also tried:</p>
  
  <p><code>For i = 1 To (CurRecord - 1)</code></p>
  
  <p>But this gives me an "Out of Range" error when it reaches the first record.</p>
  
  <p>Wonder where I am going wrong?</p>