change default font color for editing/review

G

Guest

I want to be able to write a macro to make red the default font color upon
command to be able to clearly see edits & changes, but I can't seem to be
able to do it. Clicking on Tools/Options/Colors doesn't change my font
color. I want to be able to click in any cell, write, and have it be red.
Any suggestions? Thanks.
 
G

Guest

My question may have been unclear. I want to avoid have to change the font
for each edited cell to red separately. The desired outcome is being able to
click any cell, and what you write is in red without having to manually
switch from the default, black.
 
G

Gord Dibben

Any cell or a particular range of cells?

You could use worksheet event code that would turn the font red as you entered
something.

As written the code below acts upon any cell into which you enter something.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Value <> "" Then
.Font.ColorIndex = 3
End If
End With
ws_exit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that sheet module.


Gord Dibben MS Excel MVP
 
G

Guest

Thanks- that is very helpful. How would I turn that feature on and off
without doing the whole cut and paste process?
 
G

Gord Dibben

Do you mean so's you can toggle the firing on/off as you choose?

I'm sure one of the brighter lights will have a better solution but my
limited-knowledge proposal would be to create a command button from the Control
Toolbox and have it toggle the events on/off.


Application.EnableEvents = False = Not _
Application.EnableEvents = False


When you create the button, right-click and "View Code"

Your sheet module will open and you can paste the above between these two lines.

Private Sub CommandButton1_Click()
'paste here
End Sub

NOTE: this will affect all application events.

I don't know how to turn it off for just one sheet.


Gord
 

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