Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change font size based on value of a cell
If the value of A10, 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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change font size based on value of a cell
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 " wrote: If the value of A10, 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change font size based on value of a cell
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, wrote: If the value of A10, 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change font size based on value of a cell
Thank you sooooooooooooo much Susan. It works like a charm!
Michael |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change size of font if cell value is greater than 0 | Excel Programming | |||
When I change the font size in a cell the value changes. | Excel Worksheet Functions | |||
How to change Font size based upon cell input | Excel Discussion (Misc queries) | |||
Cell value specific font size change | Excel Programming | |||
change font size and bold in cell? | Excel Programming |