![]() |
How do I "conditionally" change font size based on text length?
A cell of specific size gets a text string of variable length from another
sheet in the workbook. I would like to make the font size conditional based on the number of characters changes (i.e., more characters - smaller font). Conditional Formatting does not address font size. |
How do I "conditionally" change font size based on text length?
Private Sub worksheet_Calculate()
Dim cell as Range, l as Long set cell = Me.Range("B9") l = len(cell.text) if l < 20 then cell.Font.Size = 12 elseif l < 50 then cell.font.Size = 10 elseif l < 100 then cell.Font.Size = 9 Else cell.Font.Size = 8 end if End sub Right click the sheet tab where you want this and select view code. Put in code like the above. -- Regards, Tom Ogilvy "Found in Florida" <Found in wrote in message ... A cell of specific size gets a text string of variable length from another sheet in the workbook. I would like to make the font size conditional based on the number of characters changes (i.e., more characters - smaller font). Conditional Formatting does not address font size. |
How do I "conditionally" change font size based on text length?
You may want to try:
Format|cells|Alignment tab|text control section|check shrink to fit Not quite the same, but maybe... Found in Florida wrote: A cell of specific size gets a text string of variable length from another sheet in the workbook. I would like to make the font size conditional based on the number of characters changes (i.e., more characters - smaller font). Conditional Formatting does not address font size. -- Dave Peterson |
All times are GMT +1. The time now is 03:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com