Results 1 to 14 of 14

Middle number function

Threaded View

  1. #1
    Registered User
    Join Date
    09-16-2010
    Location
    AZ, USA
    MS-Off Ver
    Excel 2007
    Posts
    9

    Middle number function

    I have an assignment for my engineering class in which I must write a VBA program that finds the middle number of three numbers. My program compiles, but it returns 0 each time. I am not sure what I am doing wrong. Here is the code:
    Option Explicit
    Function FINDMID(a, b, c)
    Dim x As Single, y As Single
    If a > b Then
    a = x
    Else
    b = x
    End If
    
    If x < c Then
    x = y
    Else
    c = y
    End If
    FINDMID = y
    
    End Function
    Last edited by romperstomper; 09-16-2010 at 09:38 AM. Reason: add code tags

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