Excel VBA seen in worksheet but comes upSub or function not defined in module

In a spreadsheet cell I can enter =FIND("M","abcdenfgMnc")  and it gives me 9

If I have this      res = Find("M", "abcdenfgMnc")
in a Public module it says compile error  Sub or function not defined

Get the same error when I put   ? Find("M", "abcdenfgMnc")
 in an immediate window
LVL 11
Donald MaloneyConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Roy CoxGroup Finance ManagerCommented:
You cannot use a function like that in VBA. You need to use the .Find method. If you use a function in VBA you need to use

Application.WorkSheetFunction.Find)

Open in new window


Read this

What exactly are you doing?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Donald MaloneyConsultantAuthor Commented:
Coding VBA in an excel module.  Has been awhile.   Thank you
I have a string of numbers say in cell 1 with hyphens in between and was going to separate the numbers into cells e.g first in cell 2  second in cell 3 etc for a max of 20 numbers.  
I can do all that but it was bugging me why a simple vba function would not work in the called module.
0
Roy CoxGroup Finance ManagerCommented:
Pleased to help, but Text to Columns from the Data Tab would do that without VBA.
0
Donald MaloneyConsultantAuthor Commented:
Thanks  I'll check that
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.