Ajit,
You could use an event. Copy the code below, right click on your sheet tab,
select "View Code", and paste the code into the window that appears.
HTH,
Bernie
MS Excel MVP
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewFormula As String
On Error Resume Next
If Target.Cells.Count > 1 Then Exit Sub
If Not Target.HasFormula Then Exit Sub
With Application
.EnableEvents = False
NewFormula = Target.Formula
.Undo
Target.Precedents.Interior.ColorIndex = xlNone
Target.Formula = NewFormula
Target.Precedents.Interior.ColorIndex = 3
.EnableEvents = True
End With
End Sub
Ajit Munj said:
Hi
Thanks, It's working, but it does not get updated if I change the formula e.g.
if I add another cell in formula, the added cell do not get filled with
colour? Is
there any way out?
--
Knowldege is Power
Bernie Deitrick said:
Ajit,
Select the cell with the formula, press Ctrl-[, then click your color fill
button.
HTH,
Bernie
MS Excel MVP
Hi Sir,
I want excel to fill the cells with red colour (fill colour)
which are included in formula e.g.
if a1=sum(b2:b5), b2:b5 should get filled with red colour,
if f1=d1+c5+sum(x1:x5), d1,c5 and x1:x5 should get filled with red colour.
Please guide.