if cell contains formula change background colour to pale yellow

  • Thread starter Thread starter Max Bialystock
  • Start date Start date
M

Max Bialystock

I'd like to be able to do this:

if cell contains formula change background colour to pale yellow

how would I write that in vba, please
 
David here is one way

Sub Color_Formula_Cell()
On Error GoTo e:
With Cells
..Interior.ColorIndex = 0
..SpecialCells(xlFormulas).Interior.ColorIndex = 36
End With
Exit Sub
e: MsgBox "There are no formulas or the sheet is protected"
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
 

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

Back
Top