View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Scroll Bars in UserForms

Hi James

Put a Frame1 on a new userform. Put a Frame2 inside Frame1. Put whatever
onto Frame2 just to watch. Insert a vertical Scrollbar1. Try this code:

Private Sub UserForm_Initialize()
Frame2.Height = Frame1.Height * 2
ScrollBar1.Max = Frame1.Height
ScrollBar1.LargeChange = ScrollBar1.Max / 4
ScrollBar1.SmallChange = 8
End Sub

Private Sub ScrollBar1_Change()
Frame2.Top = -ScrollBar1.Value
End Sub

Private Sub ScrollBar1_Scroll()
Frame2.Top = -ScrollBar1.Value
End Sub



--
HTH. Best wishes Harald
Followup to newsgroup only please

"Jmbostock " skrev i melding
...
I've a userform that sometimes extends beyond the edge of the screen, so
i'd like to put a vertical scroll bar in to view the whole thing.

I've tried google, but the closest i got was a page in german, which i
don't speak.

Can anyone explain or direct me to a webpage that can tell me how to
put a scroll bar into a large userform to scroll to the bottom and top.


I'm not sure if it matters, but the userforms size is variable based on
the number of rows matching particular criteria. I can't imagine it
will, but just thought i would mention it just in case it effects it.

Thanks

James


---
Message posted from http://www.ExcelForum.com/