PDA

View Full Version : Solved: Getting two scrollbars to scroll simultaneously



zagrijs
12-19-2012, 07:18 AM
:hi:

I have a form with two frames and the vertical scrollbar on both on.

I need code to get frame1's scrollbar to move same direction and distance as frame2's scrollbar when frame2's scrollbar is moved by the user.

The parameters of the scrollbars drive me nuts. :banghead:

Your help would be appreciated.

Thanks in advance

Zagrijs

: pray2:

david000
12-19-2012, 05:07 PM
If you have a form with two separate lists loaded in them you can make them match each others lists by the index number.



Private Sub ListBox1_Change()
ListBox2.ListIndex = ListBox1.ListIndex
End Sub

zagrijs
12-19-2012, 11:11 PM
Thanks David.

However, I don not see how that solves my challenge. I'm talking about two frames with scrollbars, not two listboxes.

snb
12-20-2012, 12:07 AM
Use the scroll event:


Private Sub Frame1_Scroll(ByVal ActionX As MSForms.fmScrollAction, ByVal ActionY As MSForms.fmScrollAction, ByVal RequestDx As Single, ByVal RequestDy As Single, ByVal ActualDx As MSForms.ReturnSingle, ByVal ActualDy As MSForms.ReturnSingle)
Frame2_Scroll ActionX, ActionY, ActionY, RequestDy, ActualDx, ActualDy
End Sub

zagrijs
01-21-2013, 04:41 AM
VBAX Mentor,

Thanks for your assistance. Apology for not repsonding sooner. I was out of town and only saw your response today.

Kind regards.