HasFormula

  • Thread starter Thread starter John Wirt
  • Start date Start date
J

John Wirt

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top