» Return error values from user defined functions using VBA in Microsoft Excel
CATEGORY - Custom Functions , Printing in VBA
VERSION - All Microsoft Excel Versions
Return error values from user defined functionsWith 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:
- Special Edition Using Microsoft Excel 2002
- Microsoft Windows XP Step by Step (With CD-ROM)
- Not-for-Profit Accounting Made Easy
- Financial Risk Manager Handbook, Second Edition
- Final Accounting: Ambition, Greed and the Fall of Arthur Andersen
- Rich Dad's Guide to Investing: What the Rich Invest in, That the Poor and the Middle Class Do Not!
No comments have been submitted.

