Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Perth, Western Australia, Australia
    Posts
    487
    Thanks
    75
    Thanked 2 Times in 1 Post

    User Defined function problem

    Hi All,

    I have this function below, sometimes when I open the spreadsheet it returns a #name? error.

    I've tried to trigger the calculation with F9 but no good. Then if I close the Spread sheet and reopen it, the function works.

    Any thoughts on what might be causing this and how to fix the problem?


    Function CheckColor1(range)
    Application.Volatile (True)
    If range.Interior.Color = RGB(153, 204, 0) Then
    CheckColor1 = "Completed"
    'use this to include diffent color RGB's
    'ElseIf range.Interior.Color = RGB(0, 256, 0) Then
    'CheckColor1 = "Go"
    Else
    CheckColor1 = ""
    End If
    End Function

    Regards
    Last edited by verada; 2015-08-05 at 23:46. Reason: typo

  2. #2
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,639
    Thanks
    115
    Thanked 651 Times in 593 Posts
    Try replacing "range" with "rng
    Code:
    Function CheckColor1(rng As range) As String
    Application.Volatile (True)
    If rng.Interior.Color = RGB(153, 204, 0) Then
       CheckColor1 = "Completed"
    Else
       CheckColor1 = ""
    End If
    End Function

  3. The Following User Says Thank You to Maudibe For This Useful Post:

    verada (2015-08-06)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •