If I run:
Sub dural()
MsgBox ActiveSheet.Cells.HasFormula
End Sub
It will display True if all the occupied cells in the worksheet have formulas, and it will display False if none of the occupied cells in the worksheet have formulas.
However if some of the occupied cells have formulas, the documentation
says the property will return Null
How can I craft a MsgBox to display this case ??
You can use the IsNull function
You can use a function instead of a Sub so you can test where you called it from.
Function dural() As Variant
dural = ActiveSheet.Cells.HasFormula
If IsNull(dural) = True Then
MsgBox "It's null"
End If
End Function
or leave it as a sub
Sub dural()
Dim test as Variant
test= ActiveSheet.Cells.HasFormula
If IsNull(test) = True Then
MsgBox "It's null"
End If
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With