Skip to main content

Range.HasFormula property

Table of contents
  1. Syntax
  2. Example

True if all cells in the range contain formulas; False if none of the cells in the range contains a formula; null otherwise. Read-only Variant.



expression A variable that represents a Range object.


This example prompts the user to select a range on Sheet1. If every cell in the selected range contains a formula, the example displays a message.

Set rr = Application.InputBox(prompt:="Select a range on this worksheet", Type:=8)
If rr.HasFormula = True Then
    MsgBox "Every cell in the selection contains a formula"
End If

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>