Userform Scrollbar help

kidwispa

Active Member
Joined
Mar 7, 2011
Messages
330
Hi,

I have a userform that is too big to fit on my screen so some elements aren't visible. I originally tried using the scroll bars in properties but that doesn't seem to work (the scrollbars appear on the form but there is no way of moving down).

I searched online and found the following code that gives me a working scrollbar:

Code:
Private Sub UserForm_Activate()    With Me
        'This will create a vertical scrollbar
        .ScrollBars = fmScrollBarsVertical
        
        'Change the values of 2 as Per your requirements
        .ScrollHeight = .InsideHeight * 1.25
        .ScrollWidth = .InsideWidth * 9
    End With
End Sub

However the one issue I'm having is that when I tab between sections on the userform it still stays focussed on the same place, so for example when I tab to a textbox that is off screen it still stays showing the top of the userform, and you can't see it without having to move the scrollbar down.

Is there a way to get the focus of the userform to be on the area that you have tabbed to?

Hope this makes sense!

Thanks in advance for all help!

:)
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
In order to get the scrollbars working when set at Design time, the ScrollHeight property of the form must be larger than the Height.

I can't replicate the other issue - when I tab, focus changes accordingly.
 
Upvote 0

Forum statistics

Threads
1,214,575
Messages
6,120,342
Members
448,956
Latest member
Adamsxl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top