ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HasFormula (https://www.excelbanter.com/excel-programming/352594-hasformula.html)

John Wirt[_12_]

HasFormula
 
Can someone say what kinds of formulas are detected as being present in a
cell by the HasFormula property?

Some different kinds of formulas:

=A30

=A30/K$29

=A20*A21

=atan(A20)

Also, can someone say what this statement will return and define as the
rngDst.

With ActiveCell
...
Set rngDst = Range(.Formula)
...
EndWith

depending upon which of the above formulas is in the ActiveCell?

Thank you.

John Wirt



Tom Ogilvy

HasFormula
 
Select all your cells and do Edit=Goto=Special and select Formlas.

All you show would qualify as a formula.

from the immediate window:

? activeCell.HasFormula
True
? activeCell.Formula
=10
ActiveCell.Value = 10
? activeCell.HasFormula
False
?ActiveCell.Formula
10


Your second question is that none of the formula strings are valid range
references except =A30, so they would all return error except =A30.

From the immediate window:

?Range("=A30").Address
$A$30

--
Regards,
Tom Ogilvy

"John Wirt" wrote in message
...
Can someone say what kinds of formulas are detected as being present in a
cell by the HasFormula property?

Some different kinds of formulas:

=A30

=A30/K$29

=A20*A21

=atan(A20)

Also, can someone say what this statement will return and define as the
rngDst.

With ActiveCell
...
Set rngDst = Range(.Formula)
...
EndWith

depending upon which of the above formulas is in the ActiveCell?

Thank you.

John Wirt






All times are GMT +1. The time now is 08:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com