20 minutes trying...

  • Thread starter Thread starter Jim May
  • Start date Start date
J

Jim May

With the following in a standard module:

Function IsFormula(cell As Range) As Boolean
IsFormula = cell.HasFormula
End Function

In cell A4 of sheet1 there is a formula = Sum(A1:A3)
In cell B4 I have =IsFormula(A4) -->> Displaying #Value?

I've search google, etc..
CRAP!!
 
Works fine for me Jim.

Does the range A1:A3 have anything odd i it?
Does A4 sum to the correct value?
 
It works fine for me. Just to confirm the code is in a regular module "Module
1" (or the like) and not in the sheet or in "ThisWorkbook".
 
this works for me

Private Function IsFormula(cell As Range) As Integer
If cell.HasFormula Then
IsFormula = 1
Else
IsFormula = 0
End If
End Function
 
Were you playing with named ranges beforehand? Did you create one named
IsFormula?

Any chance your module name is IsFormula (as well as the function name)?
 
A1:A3 contains 123, 234, 345 respectfully
A4 displays 702 ( = Sum(A1:A3))
B4 = = Isformula(A4) -- Displaying #Name?

Did I indicate #VALUE? before.. CRAP yes
I should have indicated #Name? this is what's
being displayed..
Sorry,
 
try:
Function IsFormula(cell As Range) As Boolean
If Cell.HasFormula Then
IsFormula = True
Else
Is Formula = False
End If
End Function
 
As Jim said, put it in a general module, not the sheet module.
 
OK, everything before now was based on my having the Isformula() in my
Personal.xls file. << where it wasn't working!!

I just copied the complete function into a std module of the subject
workbook, And it Worked !!

What's the difference? Does this prompt a reaction?
TIA,,,
Jim
 
=personal.xls!isformula(a4)


Jim said:
OK, everything before now was based on my having the Isformula() in my
Personal.xls file. << where it wasn't working!!

I just copied the complete function into a std module of the subject
workbook, And it Worked !!

What's the difference? Does this prompt a reaction?
TIA,,,
Jim
 
HooRay!!!
Is this always the rule (prefacing with =personal.xls!)?
Tks Dave,
Jim
 
No, it's not always the rule. If you go to the VB Editor, select your
workbook, then go to Tools/References and put a check mark in front of
Personal.xls, then you don't have to precede the function name with
personal.xls!

HooRay!!!
Is this always the rule (prefacing with =personal.xls!)?
Tks Dave,
Jim
 
Thanks Myrna, I was thinking that I'd seen or done this without the preface
"=personal.xls".
Jim

Myrna Larson said:
No, it's not always the rule. If you go to the VB Editor, select your
workbook, then go to Tools/References and put a check mark in front of
Personal.xls, then you don't have to precede the function name with
personal.xls!
 
Never mind, I figured it out;
Needed to change Name from "VBA Project" to "Personal"
under properties.
 

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