Here are the steps to use this VBA macro code:
EXCEL IF THEN FORMULA CONDITIONAL FORMATTING CODE
This code first selects all the cells that have formulas and then applies the yellow color (specified by vbYellow). This method does exactly the same thing as the one the previous one (using Go To Special), but with a single line of code.īelow is the VBA code that will instantly highlight all the cells that have formulas in it in yellow color: Selection.SpecialCells(xlCellTypeFormulas, 23).Interior.Color = vbYellow Format Formulas using VBAĪnother quick method to quickly format cells with formulas is by using VBA. You will have to repeat the same process again. For example, you can apply a cell color or can change the font to bold.Īs I mentioned, now if you add a new formula to the range, it will not get autoformatted. Once these cells are selected, you can apply whatever formatting you want. The above steps would select all the cells that have formulas in it.
Unlike the Conditional formatting method, this one is not dynamic. While this is my preferred method to autoformat formulas in Excel, there is another way as well. Since conditional formatting is dynamic and checks for each cell every time there is a change in the worksheet, the above steps make sure cells are automatically highlighted. Not only this, in case you change any of the cells and add a formula to it, the color would automatically change.
The above steps would instantly autoformat all the cells that have a formula in it. In my case, I am using the orange cell fill color