![]() |
resize my userform
Good day all,
Is there a way to make a userform with a Listbox resizeable by the user? TIA MD |
resize my userform
No, there is no way in Excel VBA.
Regards, Edwin Tam http://www.vonixx.com "MD" wrote: Good day all, Is there a way to make a userform with a Listbox resizeable by the user? TIA MD |
resize my userform
is it the userform that you want to resize, or the listbox?
new form 5 buttons (btnNarrow,btnWider,btnShorter,btnLonger) 2 text boxes(txtHeight,txtWidth) 1 listbox(listbox1) set the listbox so that it runs down the left of the form put the buttons in a column add this code: Option Explicit Private Sub UserForm_Initialize() SetTextBoxes End Sub Private Sub btnLonger_Click() txtHeight = Me.Height * 1.1 btnResize_Click End Sub Private Sub btnNarrow_Click() txtWidth = Me.Width * 0.9 btnResize_Click End Sub Private Sub btnShorter_Click() txtHeight = Me.Height * 0.9 btnResize_Click End Sub Private Sub btnWider_Click() txtWidth = Me.Width * 1.1 btnResize_Click End Sub Private Sub btnResize_Click() On Error Resume Next Me.Height = txtHeight Me.Width = txtWidth ListBox1.Height = Me.Height - ListBox1.Top - 32 On Error GoTo 0 SetTextBoxes End Sub Private Sub SetTextBoxes() txtWidth = Me.Width txtHeight = Me.Height End Sub On strting the initialize event populates the two text boxes. The user can click one iof the four control buttons (longer, shorter etc) which adjust the values in the text boxes and resize th eform. Or the user can enter values and click the resize button Patrick Molloy Microsoft Excel MVP "MD" wrote: Good day all, Is there a way to make a userform with a Listbox resizeable by the user? TIA MD |
resize my userform
Sure. See FormFun at
http://www.oaltd.co.uk/Excel/Default.htm HTH. Best wishes Harald "MD" skrev i melding .. . Good day all, Is there a way to make a userform with a Listbox resizeable by the user? TIA MD |
resize my userform
Hi,
Here's an example of resizing the userform using a resize handle without resorting to APIs. http://www.andypope.info/vba/resizeform.htm Cheers Andy MD wrote: Good day all, Is there a way to make a userform with a Listbox resizeable by the user? TIA MD -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
resize my userform
Andy,
That's a nice one, I am keeping it. For what's its worth, here is my modified version of some code that Greg Koppel posted in April 2002. Add a spinner to a user form, paste the code into the form module. '-------------------------------- Private Sub SpinButton1_SpinDown() Dim sngIncrement As Single sngIncrement = 5 / UserForm1.Zoom UserForm1.Height = UserForm1.Height - (sngIncrement * UserForm1.Height) UserForm1.Width = UserForm1.Width - (sngIncrement * UserForm1.Width) UserForm1.Zoom = UserForm1.Zoom - 5 Label1.Caption = UserForm1.Zoom UserForm1.Repaint End Sub Private Sub SpinButton1_SpinUp() Dim sngIncrement As Single sngIncrement = 5 / UserForm1.Zoom UserForm1.Height = UserForm1.Height + (sngIncrement * UserForm1.Height) UserForm1.Width = UserForm1.Width + (sngIncrement * UserForm1.Width) UserForm1.Zoom = UserForm1.Zoom + 5 Label1.Caption = UserForm1.Zoom UserForm1.Repaint End Sub End Sub '------------------------------- Jim Cone San Francisco, USA "Andy Pope" wrote in message ... Hi, Here's an example of resizing the userform using a resize handle without resorting to APIs. http://www.andypope.info/vba/resizeform.htm Cheers Andy Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
resize my userform
PS...
Form also requires a label control. Jim Cone "Jim Cone" wrote in message ... Andy, That's a nice one, I am keeping it. For what's its worth, here is my modified version of some code that Greg Koppel posted in April 2002. Add a spinner to a user form, paste the code into the form module. '-------------------------------- Private Sub SpinButton1_SpinDown() Dim sngIncrement As Single sngIncrement = 5 / UserForm1.Zoom UserForm1.Height = UserForm1.Height - (sngIncrement * UserForm1.Height) UserForm1.Width = UserForm1.Width - (sngIncrement * UserForm1.Width) UserForm1.Zoom = UserForm1.Zoom - 5 Label1.Caption = UserForm1.Zoom UserForm1.Repaint End Sub Private Sub SpinButton1_SpinUp() Dim sngIncrement As Single sngIncrement = 5 / UserForm1.Zoom UserForm1.Height = UserForm1.Height + (sngIncrement * UserForm1.Height) UserForm1.Width = UserForm1.Width + (sngIncrement * UserForm1.Width) UserForm1.Zoom = UserForm1.Zoom + 5 Label1.Caption = UserForm1.Zoom UserForm1.Repaint End Sub End Sub '------------------------------- Jim Cone San Francisco, USA |
resize my userform
Thanks Jim glad you like it.
Cheers Andy Jim Cone wrote: Andy, That's a nice one, I am keeping it. For what's its worth, here is my modified version of some code that Greg Koppel posted in April 2002. Add a spinner to a user form, paste the code into the form module. '-------------------------------- Private Sub SpinButton1_SpinDown() Dim sngIncrement As Single sngIncrement = 5 / UserForm1.Zoom UserForm1.Height = UserForm1.Height - (sngIncrement * UserForm1.Height) UserForm1.Width = UserForm1.Width - (sngIncrement * UserForm1.Width) UserForm1.Zoom = UserForm1.Zoom - 5 Label1.Caption = UserForm1.Zoom UserForm1.Repaint End Sub Private Sub SpinButton1_SpinUp() Dim sngIncrement As Single sngIncrement = 5 / UserForm1.Zoom UserForm1.Height = UserForm1.Height + (sngIncrement * UserForm1.Height) UserForm1.Width = UserForm1.Width + (sngIncrement * UserForm1.Width) UserForm1.Zoom = UserForm1.Zoom + 5 Label1.Caption = UserForm1.Zoom UserForm1.Repaint End Sub End Sub '------------------------------- Jim Cone San Francisco, USA "Andy Pope" wrote in message ... Hi, Here's an example of resizing the userform using a resize handle without resorting to APIs. http://www.andypope.info/vba/resizeform.htm Cheers Andy Andy Pope, Microsoft MVP - Excel http://www.andypope.info -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
resize my userform
Nice one, Andy. Thanks !
Best wishes Harald "Andy Pope" skrev i melding ... Hi, Here's an example of resizing the userform using a resize handle without resorting to APIs. http://www.andypope.info/vba/resizeform.htm Cheers Andy MD wrote: Good day all, Is there a way to make a userform with a Listbox resizeable by the user? TIA MD -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
All times are GMT +1. The time now is 02:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com