+ Reply to Thread
Results 1 to 3 of 3

How to return a value as an empty cell

Hybrid View

gone83 How to return a value as an... 01-04-2011, 11:37 AM
DonkeyOte Re: How to return a value as... 01-04-2011, 11:53 AM
DonkeyOte Re: How to return a value as... 01-04-2011, 12:04 PM
  1. #1
    Registered User
    Join Date
    12-24-2010
    Location
    KL,MY
    MS-Off Ver
    Excel 2003
    Posts
    16

    How to return a value as an empty cell

    Hello,

    I have one question.

    1. How to return a value as empty cell.

    Function GPH(FC, CT, PSM, TMS, ROT_type As String) As Double
       FCCT = FC / CT
       If FCCT >= 20 Then
        Select Case LCase(ROT_type)
            Case "si"
                GPH = ROT_SI(20, 1, PSM, TMS)
            Case "vi"
                GPH = ROT_VI(20, 1, PSM, TMS)
            Case "ei"
                GPH = ROT_EI(20, 1, PSM, TMS)
            Case "lti"
                GPH = ROT_LTI(20, 1, PSM, TMS)
            End Select
       ElseIf FCCT <= 1 Then
            Select Case LCase(ROT_type)
            Case "si"
                GPH = Empty
            Case "vi"
                GPH = Empty
            Case "ei"
                GPH = Empty
            Case "lti"
                GPH = Empty
            End Select
      Else
              Select Case LCase(ROT_type)
            Case "si"
                GPH = ROT_SI(FC, CT, PSM, TMS)
            Case "vi"
                GPH = ROT_VI(FC, CT, PSM, TMS)
            Case "ei"
                GPH = ROT_EI(FC, CT, PSM, TMS)
            Case "lti"
                GPH = ROT_LTI(FC, CT, PSM, TMS)
            End Select
        End If
        
    End Function
    and I want this GPH return as empty cell.
    ElseIf FCCT <= 1 Then
            Select Case LCase(ROT_type)
            Case "si"
                GPH = Empty
            Case "vi"
                GPH = Empty
            Case "ei"
                GPH = Empty
            Case "lti"
                GPH = Empty
            End Select

    Thanks guys!!!!

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to return a value as an empty cell

    Perhaps you mean a Null, first change return type to Variant (from Double)

    ElseIf FCCT <=1 Then
        Select Case LCase(ROT_type)
            Case "si", "vi", "ei", "lti"
                GPH = ""
        End Select
    Else
        'remaining code
    End If
    though given you don't appear to cater for any other ROT_type you might as well dispense with that Select Case altogether and just use:

    ElseIf FCCT <= 1 Then
        GPH = ""
    Else
        'remaining code
    End If

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to return a value as an empty cell

    FWIW, you might get away with:

    Function GPH(FC, CT, PSM, TMS, ROT_type As String) As Variant
        FCCT = FC / CT
        If FCCT >= 20 Then
            GPH = Application.Run("ROT_" & UCase(ROT_type), 20, 1, PSM, TMS)
        ElseIf FCCT <= 1 Then
            GPH = ""
        Else
            GPH = Application.Run("ROT_" & UCase(ROT_type), FC, CT, PSM, TMS)
        End If
    End Function

+ 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