+ Reply to Thread
Results 1 to 2 of 2

Part of If statement not working

  1. #1
    Registered User
    Join Date
    10-31-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    41

    Part of If statement not working

    I am just starting learning VBA, so I am doing some nice easy examples such as the function below. I got =area(#,#) working, but =area(#) is returning #VALUE!. Thoughts?

    Function Area(Length As Double, Width As Double)
    If IsMissing(Width) Then
    Area = Length * Length
    Else
    Area = Width * Length
    End If
    End Function

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Part of If statement not working

    IsMissing is to check if optional arguments are missing.

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

+ 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