Macro to adjust a textbox to the size of the text

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,386
Hi Everyone,

I've been playing around with activex text boxes and have found I can adjust the height as I type.
so what I would like is a bit of code that can adjust the textbox to one line bigger (or the size of the text i'm tying in

I have this bit of code that will resize the text box so I need someone to show me how to make it dynamic if possibleplease

this is what I have it triggers everytime you type into the textbox.

Code:
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Private Sub TextBox1_Change()
    ActiveSheet.Shapes("TextBox1").Height = 300[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]End Sub[/FONT]
please help if you can thanks

Tony
 

Akuini

Well-known Member
Joined
Feb 1, 2016
Messages
2,477
Office Version
365
Platform
Windows
Maybe something like this:

Code:
Private Sub TextBox1_Change()
   TextBox1.Height = TextBox1.Height + 20
End Sub
 

Forum statistics

Threads
1,085,513
Messages
5,384,111
Members
401,881
Latest member
Dato

Some videos you may like

This Week's Hot Topics

Top