Expand cell height to match textbox

Mcfg007

New Member
Joined
Mar 10, 2018
Messages
45
How can I get the cells to expand with the size of a texbox. I am entering text and the Activex texbox is expanding with Multiple lines accordingly to the text, but after a period goes over other fields, How can I get the field cells to expand?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I believe you can use the wraptext property, for example

Range("A1").WrapText = True

but this will increase the height of the row related to the relevant cells.
 
Upvote 0
I believe you can use the wraptext property, for example

Range("A1").WrapText = True

but this will increase the height of the row related to the relevant cells.

Sorry, I don't follow. Where do I place that code? My Activex Texbox is on top rows D-J 18 & 19
 
Upvote 0
I read somewhere about this code but not too sure how to go about it as I see no reference to specific sheet or textbox.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count = 1 And IsEmpty(Target) Or Not IsEmpty(Target)
Then Range("A9").RowHeight = ActiveSheet.Shapes("Scope_IL_Definition_TB").Height
End If
End Sub


can anyone help?
 
Upvote 0
Sorry...I didn't understand your question initially.

The code you have pasted, as I understand seems to change the height of the 9th row depending on the height of some shape, if a single cell is selected, so I believe this won't work for you.

I tried to expand the size of an ActiveX textbox but the text appeared awful on my PC. I hope somebody will be able to help you as I'm not a big fan of using ActiveX controls as some events do not exist (for example AfterUpdate)
 
Upvote 0
Sorry...I didn't understand your question initially.

The code you have pasted, as I understand seems to change the height of the 9th row depending on the height of some shape, if a single cell is selected, so I believe this won't work for you.

I tried to expand the size of an ActiveX textbox but the text appeared awful on my PC. I hope somebody will be able to help you as I'm not a big fan of using ActiveX controls as some events do not exist (for example AfterUpdate)

Yes I see what you mean, I am only using Activex Box because they don't have the 256 limit on characters like normal boxes do.

That code was something I saw elsewhere, just wondering if it could be adjusted and it seamed that was written to adjust the rows depending of the size of the textbox.

My question is, I have inserted an Activex Texbox which is covering two from rows 18 and 19 from D to J. I wanted row 19 to expand down if the textbox expands with the amount of text in it.

Appreciated if any one could help please?
 
Upvote 0
Yes I see what you mean, I am only using Activex Box because they don't have the 256 limit on characters like normal boxes do.

I don't know of such limit...In fact, in most of the MS Form control textboxes I am using at the tools at work, there are much more than 256 characters in them.
 
Upvote 0
Yes, I mean to be then linked to another text box. The text is enter on one sheet texbox which then shows on a separate sheet on another textbox. If is a normal text box only shows up to 256 characters of the first box. hence why using activex boxes. the issue obviously now is on my impute txt box I have cursors to move up and down to see text, but on my other sheet I need the box to expand as it will be printed, therefore need the cell to expand to be able to see information that is below.
 
Upvote 0
Perhaps something like this:-
Code:
Private Sub TextBox1_Change()
With TextBox1
    .AutoSize = True
    .MultiLine = True
    .WordWrap = True
    .TopLeftCell.RowHeight = TextBox1.Height
    .Width = 100 'Set as required
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,422
Messages
6,119,395
Members
448,891
Latest member
tpierce

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