» Return error values from user defined functions using VBA in Microsoft Excel
CATEGORY - Custom Functions , Printing in VBA
VERSION - All Microsoft Excel Versions
With the example function below you can get user defined functions to return error values
just like the built in functions in Excel do.
Function DummyFunctionWithErrorCheck(InputValue As Variant) As VariantIf InputValue < 0 Then ' return an error valueDummyFunctionWithErrorCheck = CVErr(xlErrNA) ' retunerer #I/T!' xlErrDiv0, xlErrNA, xlErrName, xlErrNull, xlErrNum , xlErrRef, xlErrValueExit FunctionEnd If' do the calculationDummyFunctionWithErrorCheck = InputValue * 2End Function
Book Store:
Recommended Books:
- Keys to Reading an Annual Report (Barron's Business Keys)
- Accounting Principles, with CD, 6th Edition
- Learn MS Excel 2002 VBA/XML Programming
- Successful Business Planning in 30 Days: A Step-By-Step Guide for Writing a Business Plan and Starting Your Own Business
- Microsoft Windows XP Inside Out
- Windows XP for Dummies
No comments have been submitted.

