+ Reply to Thread
Results 1 to 7 of 7

Stop Function From Running

  1. #1
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Stop Function From Running

    Hi,

    Is there anyway to avoid a function script from running? I have a script that is running along fine till it changes something in one of the cells then the function script takes over and never goes back to the other script?

    Not sure what to do?

    I have this say in Range(C67 =findcolor(C4:C49)

    Please Login or Register  to view this content.

    Thank You, Mike

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Stop Function From Running

    What is the intended purpose of this function? I don't understand where the variable j leads, actually the whole line with j is confusing. What is the "other script" that you are refering to?
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Stop Function From Running

    Hello Mike,

    Are you trying to use a UDF within a formula?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Stop Function From Running

    My Mistake, That J line is suppose to be null out.

    The function counts the number of cells that are yellow in a range.

    The other script is from a userform button push. which changes a cells value when the value changes it fires this function script.

    Here is a snipit from that script:
    Please Login or Register  to view this content.
    When steping through the script when I hit "Rng2.ClearContents" the function script fires but never returns back to the next line in the script above.

    The correct Function Script is:

    Please Login or Register  to view this content.
    Thank You, Mike

  5. #5
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Stop Function From Running

    I set up a quick test, but I couldn't mimick your results; code I put after the clearcontents still ran. Did you try stepping through the code to see what happens? What code is next after Rng2.ClearContents?

  6. #6
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Stop Function From Running

    Leith, Yes I made this function up with help from snb here.

    http://www.excelforum.com/excel-prog...rom-a-sub.html

    Then I changed things a bit.

    So now I just get the number of yellow cells.

    Like in cell C67 = FindColor(C4:C49) I have these Functions in about 9 cells through out the worksheet with differnt ranges of coarse.

    Thank You, Mike

  7. #7
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Stop Function From Running

    Dave, I was stepping through when I noticed the issue. This was working before I made these functions up. Maybe I should change these functions to subs and fire in a worksheet change, That way I could control when they fire.

    But maybe that isn't even the issue. Let me throw some stops in the code to see if really keeps going...

    My mind is messed up today...

    Thanks for your help... Mike

+ 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