VBA not working

cljim

New Member
Joined
Sep 23, 2014
Messages
4
Hi everybody, I formatted my computer and since then vba functions are not working. Before the format I used excel 2010 and everything worked great (vba functions), but after formatting I installed excel 2013 and it started.

When I create a function in vba (anyone), and after that I use the function in the spreadsheet it always returns the same error: #VALUE!

For example: I introduced this code in vba:

Function inandout(x, y)
inandout = x + y


End Function

after that I tried to use the formula for 5,2 = I wrote in the bar: =inandout(5,2)

and it gives me the error: #VALUE!

That happens with all the function while before formatting it didn´t happen. I´ve already tried uninstalling the 2013 version and installing again the 2010, but it happens in this version too. Macros are allowed and the document is saved as a xslm. Could you help me to fix this?

Thank you so much in advance
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
cljim,

Welcome to the MrExcel forum.

Here is an update to your function:

Code:
Function inandoutV2(x, y) As Long
' hiker95, 09/23/2014, ME807270
inandoutV2 = x + y
End Function



Excel 2007
B
47
5112
Sheet1
Cell Formulas
RangeFormula
B4=inandoutV2(5,2)
B5=inandoutV2(12,100)
 
Last edited:
Upvote 0
Thank you so much for your help hiker95 but it´s not working, I´ve tried a lot of functions without result. It always gives me back the error:#VALUE!

 
Upvote 0
cljim,

I had placed the function code in a Module in the active workbook.

Where does your function code reside?
 
Upvote 0
cljim,

The new function works correctly in Excel 2007, from a module in the active workbook.

I have no experience with Excel 2013.


Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0
cljim,

The new function works correctly in Excel 2007, from a module in the active workbook.

I have no experience with Excel 2013.


Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.

Hi Hiker95,

First of all thank you for your help. I tried in both excel 2010 and 2013 without results. I have uninstalled office and install it again four times but it seems like an internal problem. I´ve noticed that functions with only one variable works correctly, e.g:
Function first(x)
first = x
End Function

But when I try to add another variable it returns the error.

Do you know which could be the problem? I need vba for a class.

Thank you.
 
Upvote 0
cljim,

First of all thank you for your help.

You are very welcome. Sorry that I was not able to solve your request.


Do you know which could be the problem?

I do not have a clue.


I need vba for a class.

Try asking one of the other students, or, one of the teachers.


And, also try:

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0
cljim,

It's possible that you don't have the VBA Library referenced by your VBA project.

From the VBA Editor: Tools > References
On the Available References list, look for "Visual Basic For Applications" and make sure it is checked.

EDIT: I just noticed in Post #7 that some User Defined Functions worked for you after your reinstall, so what I describe above probably isn't the problem.
Nonetheless, it may be worth checking.
 
Last edited:
Upvote 0
When I create a function in vba (anyone), and after that I use the function in the spreadsheet it always returns the same error: #VALUE!

For example: I introduced this code in vba:

Function inandout(x, y)
inandout = x + y


End Function

after that I tried to use the formula for 5,2 = I wrote in the bar: =inandout(5,2)
I´ve noticed that functions with only one variable works correctly
What is the separator that you use between arguments when you use the built-in Excel functions? IF it is a semi-colon, then you must use a semi-colon when you call your UDF in a worksheet formula like this...

=inandout(x;y)

You would only use a comma if you use commas to separate your argument with built-in functions (in VB code that may call your code, there you would use a comma no matter what you use on the worksheet).
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top