ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if cell contains formula change background colour to pale yellow (https://www.excelbanter.com/excel-programming/299737-if-cell-contains-formula-change-background-colour-pale-yellow.html)

Max Bialystock

if cell contains formula change background colour to pale yellow
 
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


--
Regards,
David Lindstrom



Paul B[_6_]

if cell contains formula change background colour to pale yellow
 
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 **
"Max Bialystock" wrote in message
...
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


--
Regards,
David Lindstrom





Max Bialystock

if cell contains formula change background colour to pale yellow
 
Paul,

That's terrific thank you. That's just what I wanted.

--
Regards,
David Lindstrom


"Paul B" wrote in message
...
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 **
"Max Bialystock" wrote in message
...
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


--
Regards,
David Lindstrom








All times are GMT +1. The time now is 02:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com