I've a User Form that allows the user to filter a list and view single record information (rows) within the User form. Using arrows on the User Form, they can go to the next visible record (row) in the filtered list to view that information. Both the code examples I found from THIS thread work great for going to the next visible row, but neither work for going back up! I tried changing Offest(1) to Offset(-1) but it didn't work.
This is the code I've currently. Arrow 1 should move to the previous visible row and retrieve the row number and assign to ProcRow (ProcRow has already been defined during the user's initial search and item selection).
In a nutshell, I'm looking for code to move up or down a filtered list and retrieve the row number when the user selects either Arrow 1 (up) or Arrow 2 (down).
Thank you
This is the code I've currently. Arrow 1 should move to the previous visible row and retrieve the row number and assign to ProcRow (ProcRow has already been defined during the user's initial search and item selection).
VBA Code:
If Arrow = 1 Or Arrow = 2 Then
If Arrow = 1 Then
Set cel = Sheet2.Range("C" & ProcRow)
ProcRow = Range(cel.Offset(-1), cel.Parent.Cells(Rows.Count, cel.Column)).SpecialCells(xlCellTypeVisible).Cells(1, 1).Row ###(Not working)###
Else
Set cel = Sheet2.Range("C" & ProcRow)
ProcRow = Range(cel.Offset(1), cel.Parent.Cells(Rows.Count, cel.Column)).SpecialCells(xlCellTypeVisible).Cells(1, 1).Row ###(Working)###
End If
End If
In a nutshell, I'm looking for code to move up or down a filtered list and retrieve the row number when the user selects either Arrow 1 (up) or Arrow 2 (down).
Thank you