Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default 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
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
Change size of font if cell value is greater than 0 [email protected] Excel Programming 2 November 1st 07 01:31 PM
When I change the font size in a cell the value changes. Value increases with increase in font. Excel Worksheet Functions 5 June 28th 07 11:00 PM
How to change Font size based upon cell input Ashley McKay Excel Discussion (Misc queries) 5 March 23rd 07 06:44 PM
Cell value specific font size change Geoff C Excel Programming 7 February 6th 06 09:10 AM
change font size and bold in cell? R Doornbosch Excel Programming 7 February 10th 04 12:03 AM


All times are GMT +1. The time now is 01:28 PM.

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

About Us

"It's about Microsoft Excel"