Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good day all,
Is there a way to make a userform with a Listbox resizeable by the user? TIA MD |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I could NOT resize the axis title but excel allows me to resize gr | Charts and Charting in Excel | |||
I could NOT resize the axis title but excel allows me to resize gr | Charts and Charting in Excel | |||
How to create labels in a UserForm dynamically and be able to resize them with the mouse. | Excel Programming | |||
How to Resize Userform? | Excel Programming | |||
How to Resize Userform? | Excel Programming |