Excel VBA: Does Cell Have Formula

< Back to Search results

 Category: [Excel]  Demo Available 

Excel VBA: Does Cell Have Formula


Got any Excel/VBA Questions? Free Excel Help

This UDF will return TRUE if the referenced cell houses an Excel formula

The Code

Function IsFormula(Check_Cell As Range)

IsFormula = Check_Cell.HasFormula

End Function

To use this UDF push Alt+F11 and go Insert>Module and paste in the code. Push Alt+Q and save. The Function will appear under "User Defined" in the Paste Function dialog box (Shift+F3). Use the Function in any cell as shown below. 

This will return TRUE if A1 houses a formula. It is very useful when used with Conditional Formatting as you can dynamically color all formulae cells.


See also:

Tick Cell Upon Selection
Excel VBA: Number of Specified Days in a Specified Month
Excel VBA: Code to Locate Two Matches in 2 Separate Columns
Excel VBA: Does Cell Have Formula


Free Training Course: Lesson 1 - Excel Fundamentals


See also: Index to Excel VBA Code; Index to Excel Freebies; Lesson 1 - Excel Fundamentals; Index to how to… providing a range of solutions


Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


stars (0 Reviews)