Control Scroll bar

M

mcroozer

I am building a form in Excel using textboxes with some VB behind them.
I am new to this and I'm sure there is an easier way to build my form
but it's too late to turn around now.

I have 25 or so textboxes on the left side of the form. When I get t
textbox 22, the focus is below the viewable screen. The scroll ba
does not move with my tab order. If I tab a few more times, the focu
is returned to the textboxes on the upper right of my form.

I need to get the scroll bar to move to the bottom when I reach the en
of the screen and to the top when I go back up. Is this an Exce
setting that I am missing or can I control the scrollbar with some VB?
Thanks for your time - Mcroozer
 
L

Leith Ross

Hello Mcroozer,

Here are the macros to move the scrollbar up and down.
____________________________


Code:
--------------------
Sub ScrollUp()

Dim Y As Long

Y = Application.ActiveWindow.ScrollRow
If Y > 1 Then
Application.ActiveWindow.ScrollRow = Y - 1
End If

End Sub

Sub ScrollDown()

Dim Y As Long

Y = Application.ActiveWindow.ScrollRow
If Y < 65536 Then
Application,ActiveWindow.ScrollRow = Y + 1
End If

End Sub
_____________________________

Sincerely,
Leith Ross
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top