+ Reply to Thread
Results 1 to 4 of 4

Function Program to display an error message without a mesage box

  1. #1
    Registered User
    Join Date
    02-22-2012
    Location
    wv
    MS-Off Ver
    Excel 2007
    Posts
    22

    Function Program to display an error message without a mesage box

    I have a simple function program to calculate the inverse sine of a function. The one thing that baffles me is you can only calculate it using numbers between -1 and 1. I need to show an error message when the user tries to use like a "2" without using a message box. My code will be after this and I tried an IF conditional statement and it illustrates what I am trying to do. Naturally, what I i tried did not work.
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Function Program to display an error message without a mesage box

    Hi,

    Why not
    Please Login or Register  to view this content.
    I'm not sure why you have empty case statements. In fact why are you using a user defined function at all when there is a perfectly simple standard Excel ASIN function?

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,926

    Re: Function Program to display an error message without a mesage box

    Assuming this is some kind of educational exercise, and that the intention is to call the function from a spreadsheet (as noted, you could use the builtin ASIN() function), I will use Excel's built in error constants with the cverr function. So a statement like
    Please Login or Register  to view this content.
    will cause the function to return the #NUM error. If I remember right, to do this, it seems like you have to have your function defined as type variant.

  4. #4
    Registered User
    Join Date
    02-22-2012
    Location
    wv
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Function Program to display an error message without a mesage box

    My professor stated that there was but he wants us to take it and convert it to degrees. Do you think I could just take the excel function and then in my program just convert it to degrees.? I believe the error statement that MrShorty has stated it was I am looking for. Thank you

    brandon

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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