SheetChange Event

G

Guest

Hi All,

I need a little help with SheetChange Event. What additional code is needed
to test the following example? I understand code is required that connects
the sheet name to syntax when placed in the Microsoft Visual Basic tool.
However, I’ve not been able to determine the code.

Here is the example:

This example changes the color of changed cells to blue.

Private Sub Worksheet_Change(ByVal Target as Range)
Target.Font.ColorIndex = 5
End Sub

I really appreciate you’ll assistance.

Thanks
Paul
 
C

crispbd

Nothing needs to be added to that code. That will change the font color
of the changed cells. If it doesnt seem to be doing anything, try
closing excel and launching a new workbook, then retry the code.
 
T

Tom Ogilvy

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
Target.Font.ColorIndex = 5
End Sub

While sh holds a reference to the sheet where the cell was changed, Target
also contains that information, so no additional code is needed nor is a
separate reference to the sheet needed.
 

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