As my users use a spin button to move up/down through a column of IDs, my code finds that ID which is used in many other calculations in fields and cells. BTW, this spin button is in a userform.
When that column is not filtered, everything works fine. But when the column is filtered, I want my spin button to look for the ID that's in the next visible row. I've read several threads on this subject, but I'm still not able to make it all come together.
I think at least one of my problems is not knowing how to define these visible rows as a range.
These things I know for certain:
For now, I just want to figure out how to loop through the visible cells within a dynamic filtered range. Once I do, I believe I can figure out how to set the first and last row constraints.
I'd appreciate any help!
When that column is not filtered, everything works fine. But when the column is filtered, I want my spin button to look for the ID that's in the next visible row. I've read several threads on this subject, but I'm still not able to make it all come together.
I think at least one of my problems is not knowing how to define these visible rows as a range.
These things I know for certain:
- The first row in the range will always be >= row 11
- Even though the last row will change, it will always be <= 150.
- The column containing the IDs I'm interested in is column P
For now, I just want to figure out how to loop through the visible cells within a dynamic filtered range. Once I do, I believe I can figure out how to set the first and last row constraints.
I'd appreciate any help!
Code:
Sub testingrangeloop()
For Each Rng In Selection.Areas <<< Normally, this will NOT be a manually selected area.
For Each cl In Rng
MsgBox cl.Value
Next cl
Next Rng
End Sub