Results 1 to 2 of 2

my function is giving value error

Threaded View

  1. #1
    Registered User
    Join Date
    04-01-2011
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    23

    my function is giving value error

    Hey whenever I try and run this simple function it give me a value! error and have no clue why? What im trying to do is if VA isnt either VOLUME OR SURFACE AREA and SH isnt either PYRAMID OR PRISM then PyramidPrism is "Invalid Object" else it is just 1 for now.

    Public Function PyramidPrism(ByVal length As Double, ByVal width As Double, ByVal height As Double, ByVal volumearea As String, ByVal shape As String) As Variant
    Dim VA, SH As String

    VA = UCase(volumearea)
    SH = UCase(shape)

    If VA <> "VOLUME" And VA <> "SURFACE AREA" And SH <> "PYRAMID" And SH <> "PRISM" Then
    PyramidPrism = "Invalid Object"
    Else
    PyramidPrism = 1
    End If


    End Function
    Last edited by danielgri14; 04-08-2011 at 11:38 PM.

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