+ Reply to Thread
Results 1 to 2 of 2

IsError function doesn't accept value

  1. #1
    Registered User
    Join Date
    08-18-2015
    Location
    Utrecht, Netherlands
    MS-Off Ver
    2010
    Posts
    69

    IsError function doesn't accept value

    Hi,

    I have the following variable:

    Please Login or Register  to view this content.
    Sometimes setScale has the value 07 (then I want to loose the 0), sometime it has a value like 9B (in that case setScale can remain the same). I would expect that in the latter case setScale + 0 would return an error, but I get a type mismatch error, which is exactly why I build the IsError around it. When I apply the function in the worksheet itself, it does work..

    Any thoughts?

    Bart
    Last edited by CostCare; 05-02-2017 at 04:55 AM.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: IsError function doesn't accept value

    Hi,

    IIf always evaluates both the True and False parts. You should use an If..Then clause instead. Also, trying to add a 0 to a non-numeric string will cause a runtime error, not return an error value. You should use an error handler or test with IsNumeric or Like. Certain strings that you might not expect can be converted to numbers- e.g. 9E1 or 8D2- so Like is probably a better choice.
    Last edited by xlnitwit; 05-02-2017 at 05:07 AM.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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. When "IsError" doesn't catch error
    By shawnvw in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-21-2015, 12:57 PM
  2. [SOLVED] Can a function be modified to accept a divisor?
    By Vba Novice in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-12-2013, 04:14 PM
  3. Replies: 1
    Last Post: 12-15-2011, 08:43 PM
  4. How to filter images in a folder if VBA doesn't accept ".FileSearch" anymore?
    By marlonsaveri in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-16-2011, 03:11 PM
  5. Histogram - Excel doesn't accept my bin values, uses default
    By GroovySpreadsheetGuy in forum Excel General
    Replies: 0
    Last Post: 11-29-2005, 01:10 PM
  6. ISERROR function
    By Len in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-20-2005, 10:07 PM
  7. [SOLVED] how do I write a vlookup function within an iserror function so t.
    By JBLeeds in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-16-2005, 07:06 AM

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