PC Review


Reply
Thread Tools Rate Thread

Change font size based on value of a cell

 
 
MichaelRLanier@gmail.com
Guest
Posts: n/a
 
      8th Apr 2009
If the value of A1>0, I need the font size in a merged cell to change
from the default 10 to 16. It needs to return to the default size
when A1 returns to a value of 0. Can someone help with this?
Thanks.

Michael


 
Reply With Quote
 
 
 
 
FSt1
Guest
Posts: n/a
 
      8th Apr 2009
hi
sounds like conditional formating but unfortunately with conditional
fomating you can change the color, style, strick through and underline but
not font or font size so it looks like you're stuck with a macro.
you didn't say where your merged cells were so for test i merged B3 with B4.
change to suit.
Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Range("A1")
If Target > 0 Then
Range("B3").Font.Size = 16
Else
Range("B3").Font.Size = 10
End If
End Sub

so each time the value of A1 changes, the font size will change accordingly.

this is worksheet code so right click the sheet tab, click view code then
paste the above in.

Regards
FSt1

"(E-Mail Removed)" wrote:

> If the value of A1>0, I need the font size in a merged cell to change
> from the default 10 to 16. It needs to return to the default size
> when A1 returns to a value of 0. Can someone help with this?
> Thanks.
>
> Michael
>
>
>

 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      8th Apr 2009
this is a worksheet_change macro, which needs to be placed in the
worksheet code area where the action is taking place.
============================
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

Set Target = ActiveSheet.Range("a1")

If Target > 0 Then
With ActiveSheet.Range("c1:d1").Font
.Name = "Arial"
.Size = 16
End With
Else
With ActiveSheet.Range("c1:d1").Font
.Name = "Arial"
.Size = 10
End With
End If

End Sub
===========================
i didn't know your "default" size, so i chose "10".
c1:d1 is the merged cell.
hope this helps!

susan



On Apr 8, 12:57*pm, MichaelRLan...@gmail.com wrote:
> If the value of A1>0, I need the font size in a merged cell to change
> from the default 10 to 16. *It needs to return to the default size
> when A1 returns to a value of 0. *Can someone help with this?
> Thanks.
>
> Michael


 
Reply With Quote
 
MichaelRLanier@gmail.com
Guest
Posts: n/a
 
      8th Apr 2009
Thank you sooooooooooooo much Susan. It works like a charm!

Michael

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
increase / decrease font size based on value in cell having a formula noname Microsoft Excel Programming 1 15th Oct 2010 10:42 PM
Change font size based on value of a cell MichaelRLanier@gmail.com Microsoft Excel Discussion 1 8th Apr 2009 06:25 PM
When I change the font size in a cell the value changes. =?Utf-8?B?VmFsdWUgaW5jcmVhc2VzIHdpdGggaW5jcmVhc2Ug Microsoft Excel Worksheet Functions 5 28th Jun 2007 11:00 PM
How to change Font size based upon cell input =?Utf-8?B?QXNobGV5IE1jS2F5?= Microsoft Excel Misc 5 23rd Mar 2007 06:44 PM
Change Font Color in cell Based on another cell value =?Utf-8?B?Sm9obg==?= Microsoft Excel Programming 2 18th Nov 2005 05:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:33 PM.