dakota727
Board Regular
- Joined
- Dec 3, 2006
- Messages
- 164
- Office Version
- 365
OK I have not been able to get this working. What I am trying to do is to when the value in B8 is changed the format of cell C6 on sheet Diagram has the font, wrap and shrink to fit changed based on the length of the entry. Values greater than 16 small font and wrap text. Values less than 16 large font with shrink to fit.
I'm not sure where I am going wrong.
I must admit I always struggle with on change events. Any help would be appreciated.
Thanks
I'm not sure where I am going wrong.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$8" Then
If Len(Target) > 16 Then
Application.EnableEvents = False
Worksheets("Diagram").Range("C6").Activate
With ActiveCell
.ShrinkToFit = False
.Font.Size = 11
.WrapText = True
End With
Else
Application.EnableEvents = False
Worksheets("Diagram").Range("C6").Activate
With ActiveCell
.Font.Size = 16
.WrapText = False
.ShrinkToFit = True
End With
End If
stoppit:
Application.EnableEvents = True
End If
End Sub
I must admit I always struggle with on change events. Any help would be appreciated.
Thanks