+ Reply to Thread
Results 1 to 4 of 4

Returning Error Numbers from Functions

  1. #1
    Registered User
    Join Date
    06-28-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Returning Error Numbers from Functions

    How can you get the returned error number when using CVErr?

    I've bashed together this nonsense example to show what I mean:
    Please Login or Register  to view this content.
    If the number in the argument to the IsEven function is even then it returns true however if is it odd then it returns an error.

    Of course in reality it could return any error number but how do I access this returned error number in the test_error sub? Ideally, if a function returns an error you'd want to get that number as it would allow you to deal with different recovery situations depending on what the error number is.

    Thanks

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Returning Error Numbers from Functions

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 06-17-2020 at 04:03 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    06-28-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Returning Error Numbers from Functions

    Quote Originally Posted by AlphaFrog View Post
    Please Login or Register  to view this content.
    Ah, I see.

    Thanks very much

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,137

    Re: Returning Error Numbers from Functions

    Unless I'm missing something
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extract all numbers from string, returning numbers to individual cells
    By LJBOS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-27-2020, 08:46 AM
  2. [SOLVED] Stop Functions From Returning to ormer functions
    By Neuk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-13-2017, 04:53 PM
  3. [SOLVED] Returning multiple results using an Array with AND and OR functions
    By simmo86 in forum Excel General
    Replies: 6
    Last Post: 12-28-2016, 07:12 PM
  4. Loop Nesting is returning Run-Time Error '-2147221080 (800401a8)': Automation Error
    By ChristopherBrandonKi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2014, 02:36 PM
  5. VBA Functions returning Arrays
    By shen07 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2013, 05:25 PM
  6. Replies: 1
    Last Post: 02-25-2013, 04:25 PM
  7. [SOLVED] Nested If functions are not returning correct values.
    By ybortony in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-21-2012, 01:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1