Text box size

HotLanta

Board Regular
Joined
Nov 3, 2005
Messages
176
Hello all,

I have a spreadsheet with 10,000 text boxes (well maybe 50). It makes me angry when I run across one and it doesn't have the same uniform shape that it's brothers and sisters have.

I have found code on the web for creating text boxes of a certain height and width but not for running on an exsisting text box.

I tried using the recorder and even modifing found code but nothing has worked. Could someone provide a little code for the following situation:

I want to select a text box and run a simple macro to adjust its height and width.

If code is provided I can play around with it until I find the height and width I need.

Also I don't want to run this on ALL textboxes as I have some big ones and small ones. I thought I could play around with it and save one as macro_big and another as macro_small. You get the idea.

Thanks in advance!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Quick and dirty code below. It should probably test that a textbox is selected before displaying the input boxes...

Code:
Sub Text_Box()
Dim w As Double
Dim h As Double

w = InputBox("Please enter width") * 28.34645669291
h = InputBox("Please enter height") * 28.34645669291

With Selection.ShapeRange
    .Width = w
    .Height = h
End With
End Sub
 
Upvote 0
Where did you get the TextBoxes from... the Drawing toolbar or the ActiveX Control Toolbox toolbar?
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,862
Members
452,948
Latest member
UsmanAli786

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