I've created a UserForm that is intended to operate similarly to what happens when you press Ctrl+F, as far as it needs to have the functionality to display 1 row's worth of items from a list that matches the criteria of the IF function. It should start at the first row that matches the criteria, and then cycle down the list by press the the NEXT button (Me.CommandButton1), or back up by pressing the PREVIOUS button (Me.CommandButton2). I want it to stop at the bottom of the list, instead of cycling back through, although I wouldn't mind having a new button appear on the last item that says "START FROM BEGINNING". Also, I'd really like to have a way to display which entry is currently displayed, in a "# of total#" format, just like when you press Ctrl+F. I tried this myself with the following code, and realized quickly after running it that it just immediately displays the last entry (duh), and I couldn't figure out how to use a command button click to control the "Next c" portion, and I have absolutely no clue how to make it go backwards. Thanks!
Code:
Private Sub UserfForm_Initialize()
Dim ws1 As Worksheet: Set ws1 = ThisWorkbook.Sheets("Main Data")
Dim c As Range
Dim Lr As Long
Lr = ws1.Range("A" & Rows.Count).End(xlUp).Row
For Each c in ws1.Range("T7:T & Lr)
If c.Value = "" Or c.Value = "INACTIVE P" & UserForm10.ComboBox1.Value Then
Me.TextBox2.Value = c.Offset(0, -18).Value
Me.TextBox3.Value = c.Offset(0, -17).Value
Me.TextBox8.Value = c.Offset(0, -12 + UserForm10.ComboBox1.Value).Value
End If
Next c
End Sub