range.hasformula unexpected results
Sub test()
ActiveSheet.Cells.Clear
Range("$B$2:$B$3").Formula = "=9"
Debug.Print Range("$A$1:$A$3").HasFormula
Debug.Print Range("$B$2:$B$3").HasFormula
Debug.Print Range("$A$1:$B$3").HasFormula
Debug.Print Range("$B$2:$C$4").HasFormula
End Sub
False
True
Null
True
The first 3 results are as expected. The fourth I would expect to be Null.
If you now manually set $C$4 to 1 and rerun (bearing in mind the ActiveSheet.Cells.Clear) the results are
False
True
Null
Null
Its as if its doing an intersection with Used Range before looking for formula.
|