Change default font format in Excel

G

Guest

I have an existing workbook with cell text entries in regular black font. I
want to make a number of additional entries in various cells in this
workbook, and I want all my text entries to be a different font format (bold,
red). Is there a way to do this automatically without highlighting each
entry I make and manually changing the cell format? Thanks.
 
B

Bernie Deitrick

Michael,

Copy the code below, right-click on your sheet tab, select "View Code" and paste the code in the
window that appears.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Application.IsText(Target.Value) Then
Target.Font.ColorIndex = 3
Target.Font.Bold = True
End If
End Sub
 
B

Bernie Deitrick

Michael,

The version below can be switched on by putting RB into cell A1, and turned off by removing the RB
from cell A1. That might be a little more useful.

HTH,
Bernie
MS Excel MVP


Private Sub Worksheet_Change(ByVal Target As Range)
Static UseRB As Boolean
If Target.Cells.Count > 1 Then Exit Sub
If Target.Address = "$A$1" Then
If Target.Value = "RB" Then
UseRB = True
Else
UseRB = False
End If
Exit Sub
End If
If UseRB And Application.IsText(Target.Value) Then
Target.Font.ColorIndex = 3
Target.Font.Bold = True
End If
End Sub
 
G

Guest

Bernie,

Thanks very much for your replies--they are great! Is there a way I could
create a button on my toolbar to activate/de-activate this feature instead of
pasting the code in and out or using a cell reference?

Thanks,

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top