Scrollbar Position on VBA Excel Userform

When I open my userform , the horizontal scollbar starts form the middle of the page instead of the top. How can solve this problem?
thanks,
awesomejohn19Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
harr22Connect With a Mentor Commented:
I'm pretty sure that is the "scrolltop" property and setting it to 0 should fix it for you.  Do you have an initialize event that might be setting it wrong?  Try this.
Private Sub UserForm_Initialize()
    With Me
        ScrollBars = fmScrollBarsBoth
            .ScrollHeight = .InsideHeight * 1.2
            .ScrollWidth = .InsideWidth * 1.2
            .ScrollLeft = 0
            .ScrollTop = 0
    End With
End Sub

Open in new window

0
 
harr22Commented:
set the default "value" property of the scroll bar to 0
0
 
awesomejohn19Author Commented:
Ok, how do you do that in the code ?

With Me

ScrollBars = fmScrollBarsBoth
        .ScrollHeight = .InsideHeight * 1.2
        .ScrollWidth = .InsideWidth * 1.2
        .ScrollLeft = 3
        .ScrollTop = 2
   
End With
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
harr22Commented:
sorry, I thought you were refering to a scrollbar control that you had added to the form, not the scroll bar of the form itself.

Does it work like you want if you cange the left and top properties to 0?  Maybe Im confused with what you are asking.

        .ScrollLeft = 0
        .ScrollTop = 0
0
 
awesomejohn19Author Commented:
No it doesnt work.
Ok so this is what happens.
WHen i open the userform. The scrollbar is scrolled to bottom. so It does not start from the top of the userform (bottom part is visible at first), because it is scrolled down to bottom.
0
 
Rory ArchibaldCommented:
Which control on your form is first in the tab order? Is it one at the bottom?
0
All Courses

From novice to tech pro — start learning today.