ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cmbobox shrink to fit (https://www.excelbanter.com/excel-programming/370704-cmbobox-shrink-fit.html)

Shawn

cmbobox shrink to fit
 
I have a combo box and sometimes the text it is linked to is longer than the
box. Is there a way I can get the text to "shrink to fit"?


--
Thanks
Shawn

flyingmeatball[_2_]

cmbobox shrink to fit
 

right click on the cell that needs to shrink, click format cells, then
under the alignment tab, check "shrink to fit" at the bottom of the
page.


--
flyingmeatball
------------------------------------------------------------------------
flyingmeatball's Profile: http://www.excelforum.com/member.php...o&userid=37302
View this thread: http://www.excelforum.com/showthread...hreadid=572757


Shawn

cmbobox shrink to fit
 
Thanks. However, what I need is the text in the combo box to shrink to fit
the size of the combo box.
--
Thanks
Shawn


"flyingmeatball" wrote:


right click on the cell that needs to shrink, click format cells, then
under the alignment tab, check "shrink to fit" at the bottom of the
page.


--
flyingmeatball
------------------------------------------------------------------------
flyingmeatball's Profile: http://www.excelforum.com/member.php...o&userid=37302
View this thread: http://www.excelforum.com/showthread...hreadid=572757



NickHK

cmbobox shrink to fit
 
Shawn,
I would guess you have a couple of options:
- Set the combox to use a fixed width font. When you load the combobox,
multiply the number of characters in the longest entry by set some set
number. Add some for the left margin and some for the down arrow on the
right. Set the combobox width to this. Or reduce the font size until the
above calculation comes out <= combox.width
- If your list is on a worksheet, make sure the list and combobox have
the same font characteristics. Autosize the list column. Synchronise the
combox width and column width
- Set the combox.ListWidth to a large number so that the full text can be
seen in the list if not in the edit part of the combobox.

NickHK

"Shawn" wrote in message
...
I have a combo box and sometimes the text it is linked to is longer than

the
box. Is there a way I can get the text to "shrink to fit"?


--
Thanks
Shawn





All times are GMT +1. The time now is 05:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com