vba function module returns #NAME?

R

Rick

It's a simple function, so far:

Function Commission(Fee)
If Fee = 45 Then Commission = 15 Else Commission = Fee * 0.35
End Function

I've named my ranges. The module is in VBAProject | Modules.

I'm at a loss.
 
J

Jim Cone

See your earlier duplicate post.

It's a simple function, so far:

Function Commission(Fee)
If Fee = 45 Then Commission = 15 Else Commission = Fee * 0.35
End Function

I've named my ranges. The module is in VBAProject | Modules.

I'm at a loss.
 
P

Patrick Molloy

a regular module is the standard module you get when you use INSERT/MODULE
from the development IDE
-- as apposed to a Class module or code modules behind sheets and so on.
the default name will be Module1, then Module2 and so on.

If your module is named 'Class1' then this is the default name for a Class
Module, which is the wrong place for your code. cut and paste it into a
standard module, delete the class modue and see if that works
 
R

Ron Rosenfeld

It's a simple function, so far:

Function Commission(Fee)
If Fee = 45 Then Commission = 15 Else Commission = Fee * 0.35
End Function

I've named my ranges. The module is in VBAProject | Modules.

I'm at a loss.

What is the name of the Module?
--ron
 
R

Rick

It's module1. I was trying to use it in the commission column. when I moved
it to another column it worked. go figure. Thanks for all your help!

Rick
 
R

Ron Rosenfeld

It's module1. I was trying to use it in the commission column. when I moved
it to another column it worked. go figure. Thanks for all your help!

Rick

Glad you got it working. Although I doubt that moving a properly formed
formula from one column to another would have gotten rid of a #NAME error.
--ron
 
Top