+ Reply to Thread
Results 1 to 8 of 8

Macro not completing when userdefined function is used as formula

  1. #1
    Registered User
    Join Date
    10-16-2012
    Location
    gandhinagar
    MS-Off Ver
    Excel 2007
    Posts
    5

    Macro not completing when userdefined function is used as formula

    SampleSheet.xlsHi,

    I am having worksheet_change eveny specified in my sheet(sheet1 say cell A1). On this work sheet change event, I have a code that changes the cell value of some cell in another sheet(sheet2 say cell A2). I also have a formula using an userdefined function specified on some another sheet's cell (say Sheet3 cell A3). This function is something like isEmpty(Sheet1.A1).

    Now the problem is, when the worksheet_change event of sheet1 is called. Just befor I write Sheet2.A2 = "", the call to isEmty function is made. This causes my original worksheet_change event to breaked withou running further. This is causing problem in my code to executed further.

    Please help.

    Also please note that issue is faced by me only in some machines. For the rest the macro works fine.
    Last edited by maulika; 10-16-2012 at 03:00 AM. Reason: adding an attachment herein of a sample

  2. #2
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Macro not completing when userdefined function is used as formula

    Hi Maulika,
    Welcome to the forum!

    Could you attach your workbook with dummy data and macro?

  3. #3
    Registered User
    Join Date
    10-16-2012
    Location
    gandhinagar
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macro not completing when userdefined function is used as formula

    hi...please find the attachement in the earlier post befor hi.

    Thanks.

  4. #4
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Macro not completing when userdefined function is used as formula

    I dont see isempty function in the workbook. And there is a circular reference in your ismandatory function in sheet2.

  5. #5
    Registered User
    Join Date
    10-16-2012
    Location
    gandhinagar
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macro not completing when userdefined function is used as formula

    the isEmpty function I mentioned was an istance, the function provided int he sample sheets are the actual ones. And there is no circular reference hapenning.
    Last edited by Cutter; 10-17-2012 at 08:40 AM. Reason: Removed whole post quote

  6. #6
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Macro not completing when userdefined function is used as formula

    Then can you explain what is happening in this scenario? The only problem i have seen is, there is type mismatch in the value passed to ismandatory function. Thats why it is returning error. "A1" should be entered as A1 to pass it as a range.

  7. #7
    Registered User
    Join Date
    10-16-2012
    Location
    gandhinagar
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macro not completing when userdefined function is used as formula

    what actually hapenning is when the worksheet_change event encounters Sheet2.Range("B2:B2").value = 200 or 10 ; it goes for calling the isMandatory function of module1 and then once the isMandatory function is completed, it never returns back to last row that is executed for the worksheet_change event.
    Last edited by Cutter; 10-17-2012 at 08:40 AM. Reason: Removed whole post quote

  8. #8
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Macro not completing when userdefined function is used as formula

    Ok. But i remember seeing sheet3.range("b2:b2") in worksheet change function. I dont have excel now. So, i cant verify your file.

    If you think that is causing you the trouble, you can call ismandatory function in worksheet change event, and write the computed value in sheet2.

    Anyway i will look into this tomo again

+ 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