using a VB function in a spreeadsheet

B

Bill Brehm

I opened the VB editor and added a simple function to the General sheet. I
tried both ThisWorkbook and the specific sheet.

Public Function Ripple(x As Double) As Double

Ripple = x

End Function

In the spreadsheet I try to put =Ripple(A1), etc, into cells, but I get a
#Name? error. How do I get the spreadsheet to recognize the VB function?
 
B

Bill Brehm

I tried that and I still get the #Name? error. I have hit F9 to recalculate.
As a test I added two Ripple functions and when I added a new cell with that
name it popped up an error the notice the name conflict. So it seems to be
trying.

Any other suggestion?
 
B

Bill Brehm

Strange. You are right. Mine doesn't work but yours does. I just deleted
mine and renamed yours and I am happy. Thanks.
 
P

piyush1982

I was having the same problem but only when I placed the function in
Personal.xls.
When I placed the same function in a module in the workbook that I wanted to
use it in, it worked fine.

Dunno if you've already tried this?!
 
B

Bill Brehm

No I hadn't put it in personal.xls. I first started out putting it in
Microsoft Excel Objects, Sheet1 and ThisWorkbook. Then at Ardus Petus
suggestion I put it in Modules, Module1 but it still didn't work. Just now I
started over from scratch and it works fine. So I guess putting it in the
wrong place caused me some trouble.
 

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