ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change size of font if cell value is greater than 0 (https://www.excelbanter.com/excel-programming/400369-change-size-font-if-cell-value-greater-than-0-a.html)

[email protected]

Change size of font if cell value is greater than 0
 
I would like to change the size of font in a merged cell when the
value of a different cell is greater than 0. For example, if A10,
then the font in B1 (merged cells B1:D1) will change from a default of
8 to 12, and revert back to 8 when A1=0. Are there any suggestions
for a macro. Thanks in advance.

Michael


Otto Moehrbach

Change size of font if cell value is greater than 0
 
This little macro will do that. This is a sheet event macro and must be
placed in the sheet module of the sheet in question. As written, it will
change the font size of B1 to 12 if A1 is greater than 0, and it will change
it to 8 if A1 is anything else. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
If Not Intersect(Target, Range("A1")) Is Nothing Then
If Range("A1").Value 0 Then
Range("B1").Font.Size = 12
Else
Range("B1").Font.Size = 8
End If
End If
End Sub
wrote in message
oups.com...
I would like to change the size of font in a merged cell when the
value of a different cell is greater than 0. For example, if A10,
then the font in B1 (merged cells B1:D1) will change from a default of
8 to 12, and revert back to 8 when A1=0. Are there any suggestions
for a macro. Thanks in advance.

Michael




[email protected]

Change size of font if cell value is greater than 0
 
Thanks Otto. You've been a great help.

Michael



All times are GMT +1. The time now is 02:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com