» 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:
- Accounting for Dummies
- Microsoft Outlook 2002 for Dummies
- Your First Business Plan: A Simple Question and Answer Format Designed to Help You Write Your Own Plan (3rd Ed)
- The One Page Business Plan: Start With a Vision, Build a Company!
- Business Plans For Dummies®
- The McGraw-Hill Guide to Writing a High-Impact Business Plan: A Proven Blueprint for First-Time Entrepreneurs
No comments have been submitted.

