resize label on userform based on filled text

Ali M

Active Member
Joined
Oct 10, 2021
Messages
290
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Hi
is there any procedure to put in userform module to resize lable automatically based and how size of text into label instead of set size manually every time like fit ?
the lable should expand and shrink based on size of the text inside it
thanks
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Good day

Try the below. I tried it on a Userform Initialize event.

VBA Code:
Private Sub UserForm_Initialize()
    Label1.AutoSize = True
    Label1.WordWrap = False
End Sub
 
Upvote 0
Solution
thanks . unfortunately doesn't work just move down new line.
 
Upvote 0
orginal
3.PNG


should be
4.PNG
 
Upvote 0
thanks seem I mistook the place.
now it works . thanks very much :):)
 
Upvote 0
Your welcome and thanks for the feedback... Where did you put the code originally?
 
Upvote 0
Why not just set the properties at design time?
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,545
Members
449,316
Latest member
sravya

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