Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA returning "Null" for TextBox.Font.Size Leo Charts and Charting in Excel 1 February 22nd 08 01:59 PM
How do I set the default font size in the "comment" feature? Steve Excel Discussion (Misc queries) 1 November 4th 06 12:49 AM
"SHEET TAB FONT SIZE"? leesmile Excel Worksheet Functions 4 October 14th 06 12:36 AM
very large font size when using "help" menu joel Excel Discussion (Misc queries) 0 May 23rd 06 03:56 PM
Sending macro based e-mail with built-in "Heading" and "Text" Prabha Excel Programming 3 January 17th 05 02:11 PM


All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"