3

I am working on some Excel functionality using VB - but I am getting stuck at some examples. Current version is Excel 2007, using a blank Workbook; I've added in a module and trying a function like the following:

Function Addtwo(a, b)
  Addtwo = a + b
End Function

However, I get the error #VALUE! in my cell, when doing Addtwo(5,5). When trying to do Addtwo(B2,B3), Excel tells me my formula is wrong.

Thanks,

1 Answer 1

5

The pasted code is okay and works in my Excel 2007.

The only possible problems I can think of:

  • You forgot to use the equal sign: Addtwo(5,5) instead of =Addtwo(5,5)

  • Your language settings require a semicolon instead of a comma in the formula, i.e. =Addtwo(5;5) (in the worksheet formula only, not in the VBA code)

Sign up to request clarification or add additional context in comments.

1 Comment

Indeed, it is the language setting! Is the semi-colon friendly though to use in other Excel languages?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.