20 minutes trying...

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

Bob Phillips

Works fine for me Jim.

Does the range A1:A3 have anything odd i it?
Does A4 sum to the correct value?
 
J

Jim Thomlinson

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".
 
G

Gary Keramidas

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
 
D

Dave Peterson

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)?
 
J

Jim May

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

wilscott1st

try:
Function IsFormula(cell As Range) As Boolean
If Cell.HasFormula Then
IsFormula = True
Else
Is Formula = False
End If
End Function
 
J

Jim May

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
 
D

Dave Peterson

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

Myrna Larson

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
 
J

Jim May

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

Jim May

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

Top