Change Form Size after Click

  • Thread starter Thread starter Huyeote
  • Start date Start date
H

Huyeote

I have a modeless form in a XL workbook to enable user to list record
in a worksheet matching some criteria in a list box in a form. Sinc
the form is a bit big, I want to reduce the form size and hide othe
controls to show only the list box after user double clicks a record i
the list box (to show more space of the worksheet)? Can anyone show m
how to do this or direct me to some sample worbook to learn? Thanks!

Regards,

Huyeot
 
You should easily be able to adapt this :

Private Sub lstBox1_DblClick(ByVal Cancel As
MSForms.ReturnBoolean)

Const EXTRA As Integer = 30

Me.Height = lstBox1.Height + lstBox1.Top + EXTRA
Me.Width = lstBox1.Width + lstBox1.Left + EXTRA

End Sub

Private Sub UserForm_Initialize()
Dim i As Integer

For i = 65 To 80

lstBox1.AddItem Chr$(i)

Next
End Sub


Regards

Rog
 

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

Back
Top