Userform Frame automatically adjust based on cell value

Zimmerman

Well-known Member
Joined
Jan 22, 2009
Messages
663
Not sure if this is even possible, but I have a userform that has a width of 588 when fully viewed. What I'm wondering is when the user opens this I could have the width set at 150. And if in textbox2 they enter a 2 then the width of this frame will expand to 294. If the value entered in textbox 2 is 3 then this will expand to 438. if the value in textbox2 is 4 then it will expand to 588.

Thanks in advance
excel 2016
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
How about
Code:
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
   With Me.TextBox2
      If .Value < 5 And .Value > 0 Then
         Me.Width = Choose(.Value, 150, 294, 438, 588)
      End If
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top