Search code examples
excelvbaformsscrollbar

How can I prevent my Excel VBA forms from distorting when the user scrolls down using the vertical scroll bar?


I have created forms in Excel (2402) using VBA. Due to their size, I have included a vertical scroll bar so that the user can scroll down to see all the information.

However, when the user scrolls down, the form interface often distorts or collapses. How can I fix this issue and ensure that the form remains intact when the user scrolls down?

I don't know how can I fix this problem.

Sorry for my delay response. Here it is an example of the excel tool:

form_example.xlsm

When I scroll down the opened form, it distorts.

distorted_form

Thanks in advance!!


Solution

  • I have tried to force the repaint whenever the mouse has been moved:

    Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
        Me.Repaint
    End Sub
    

    However, I don't know if this is the best approach.