View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default change color of all cells with formula or are part of a formula

On Sun, 27 Jan 2008 10:17:06 -0800 (PST), wrote:

that definately works. if i wanted the sheet to change the cell
colors as i am entering data is there a way to do that? or do i have
to keep running the macro over every so often?


You could try using a worksheet selection_change event. But, depending on the
size of your worksheet, it might slow things down.

For example, right click on the sheet tab and select View Code. Then paste
this into the window that opens:

-----------------------
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
On Error Resume Next
Cells.Interior.ColorIndex = xlNone
With Cells.SpecialCells(xlCellTypeFormulas)
.Interior.Color = vbYellow
.Precedents.Interior.Color = vbRed
End With
Application.EnableEvents = True
End Sub
------------------------
--ron