Automatically expand text box

focus09

New Member
Joined
Oct 3, 2008
Messages
2
I am working on a document where I want people to input text into a text box. I want to give them enough room to write, but would like the text boxes to automatically expand so that people can type in any amount of text. If you manually expand the box, this hides data that is below the text box (the 'automatic size' option in the text box properties only makes the text box expands sideways - I want it to expand downwards).

The text box option in the control toolbar does the same - it hides the data below when expanding (plus the auto size function makes the box almost dissapear if you delete its content)

Is there a macro I could use to make a regular text box expand without hiding the data below? Alternatively, I thought a macro (linked to a button dubbed "Click here to expand the text box") could be used to expand the row height (when the "move and size with cells" option is on), but it would need to expand every time the button is clicked...

I'm no expert in VB but can make a macro work if it is ready to use

Can anyone help?

thanks!!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I'm not sure I understand what you want. You say that if it is set for auto-sizing it expands to the right, but you want it to expand downward. Yet you say that you don't want to hide the data below.
 
Upvote 0
When you expand a text box, either manually or when it's done automatically, it covers cells that are next to it. So if I have data in cells below a text box and I expand the text box downwards, the cells with data will end up being behind the text box and I won't see them anymore.

The only way I have found to expand the size of a text box and not hide anything (basically pushing down the entire worksheet) is to expand the row height (or insert a row) which is covered by the text box with the option 'Move and size with cell' on in the text box properties.

This is the case either with regular text boxes or with 'form' text boxes (inserted through the control toolbox).

What I want is for my text box to expand downwards without hiding any data that is in cells below - in effect expand downwards by pushing down the rest of the worksheet. Because I'm anticipating this document to be used by all kinds of people, I need this feature to be really simple: either the text box automatically expands downwards AND pushes the rest of the worksheet down at the same time; or I thought maybe a macro that would increase the height of a row that's behind the text box - a button-type feature where you 'Click here to expand text box' if you want to make the text box bigger (which would need to work repeatedly) (those are the thoughts of a non-VB expert, so bear with me!)

hopes this makes more sense

thanks for your help!!
 
Upvote 0
It's confusing to use the term "form text box" to refer to a text box added using the Control Toolbox. Within the VBE you can add a User Form, which is a pop-up that can include various controls (inlcuding a text box). You would typically use VBA code to control the user form (making it appear, disappear and transferring the data entered to the worksheet, if desired).

So, perhaps, a User Form is really what you need? It would be fairly easy to make it do the following:
1. A window (the user form) pops up, prompting the user to enter some text.
2. After entering the text, the user clicks on a button named "Submit" on the user form, below the text box.
3. The information entered in the text box is transferred to the spreadsheet (entered into some cell).
4. The user form goes away.

Here is a step-by-step tutorial on creating a simple userform:
http://www.contextures.com/xlUserForm01.html
 
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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