+ Reply to Thread
Results 1 to 4 of 4

Error in Value

Hybrid View

  1. #1
    Registered User
    Join Date
    10-21-2013
    Location
    Indianapolis, IN
    MS-Off Ver
    Excel 2013
    Posts
    4

    Error in Value

    This code won't output a value. It says error in value. I'm not sure what's wrong.
    Function GearRatio(Gear As Double, Gear1 As Double, Gear2 As Double, Gear4 As Double, Gear5 As Double, Gear6 As Double)
    If Gear = 1 Then
    GearRatio = Gear1
    If Gear = 2 Then
    GearRatio = Gear2
    If Gear = 3 Then
    GearRatio = Gear3
    If Gear = 4 Then
    GearRatio = Gear4
    If Gear = 5 Then
    GearRatio = Gear5
    If Gear = 6 Then
    GearRatio = Gear6

    End If
    End If
    End If
    End If
    End If
    End If


    End Function

    Do you see any obvious problems?

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,644

    Re: Error in Value

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Registered User
    Join Date
    10-21-2013
    Location
    Indianapolis, IN
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Error in Value

    Function GearRatio(Gear As Double, Gear1 As Double, Gear2 As Double, Gear4 As Double, Gear5 As Double, Gear6 As Double)
    If Gear = 1 Then
       GearRatio = Gear1
        If Gear = 2 Then
            GearRatio = Gear2
            If Gear = 3 Then
                GearRatio = Gear3
                If Gear = 4 Then
                    GearRatio = Gear4
                    If Gear = 5 Then
                        GearRatio = Gear5
                        If Gear = 6 Then
                            GearRatio = Gear6
                            
                            End If
                        End If
                    End If
                End If
            End If
        End If
        
    
    End Function

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Error in Value


+ 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. [SOLVED] Error " Run-time error '1004': application defined or object defined error
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2013, 07:26 AM
  2. Receiving following error “Complie error : syntax error” Help
    By masond3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2012, 10:19 AM
  3. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  4. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM
  5. [SOLVED] Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 PM

Tags for this Thread

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