+ Reply to Thread
Results 1 to 14 of 14

change event not triggering macro

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    change event not triggering macro

    I have a macro that when run reformats data and a dropdown box is put into cell A2. Th user then selects the case number and this change is supposed to trigger another macro (calculations), but it does not. If I manually run calculations I get a result, but can not get the change_event to work.

    Here are the codes I have tried:
    VB
    Please Login or Register  to view this content.
    VB
    Please Login or Register  to view this content.
    The way it is supposed to work is the user selects case 64 from the dropdown and the vlookup value is "Comprehensive Epilepsy". This change in A2 triggers the calculations macro (the formula is not working as expected either, but that is another issue). Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: change event not triggering macro

    You don't need to state the target range twice. Try this:

    Please Login or Register  to view this content.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: change event not triggering macro

    I changed the code to that with the same result. I can manually call calculations but the change event does not seem to work. Thank you.

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: change event not triggering macro

    I've used a very similar procedure in the past, including the user of a dropdown menu. Maybe try just using a simplified targeting, instead of intersect:


    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: change event not triggering macro

    I attached a copy of the workbook. I changed the code and put a breakpoint in on the first line of Sub Calculations and it turned red.

    The change in A2 produces a vlookup value. That value has a select case forumula that is supposed to run. In the attached if you run the classify macro and then in the dropdown in A2 select case 1, the vlookup will be Comprehensive Epilepsy. The Calculations sub is suppose to run automatically but currently I manual go in and run it. Thank you.
    Attached Files Attached Files

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: change event not triggering macro

    Really had to go line by line and test all the expression in the immediate window, but I think I found the issue.

    Case 1 is working as intended, but Case 2 has a tiny little typo.

    Const myMarfan As String = "=IF(SUMPRODUCT(--(Panel!$B$25610:$B$29333=$Q$5),--(Panel!$C$25610:$C$29333<=$R$5),--(Panel!$D$25610:$D$D29333>$R$5)),VLOOKUP($R$5,Panel!$C$25610:$E$29333,3,1),""No"")"

  7. #7
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: change event not triggering macro

    The change event doesnt seem to be working (triggering calculations) with either of the two codes, but I can run calculations manually. Thanks.
    Attached Files Attached Files

  8. #8
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: change event not triggering macro

    I'm not sure what's supposed to be happening, other than the autopopulation of formulas in AQ.

    Every time I clear column AQ, change A2, and go back the VLOOKUP formulas have reappeared. Is something else supposed to be happening?

  9. #9
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: change event not triggering macro

    Change the code to Public, instead of Private?

    I just did something on Worksheet_Change and it worked when I changed it to Public. Also I noticed the Worksheet_Change wouldn't work in a separate sub, had to be in the Sheet. I could be missing something though, I'm bad at VBA.

  10. #10
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: change event not triggering macro

    I was even able to force Case 2 to go off as well, by changing CG to Marfan Disorder, and changing A2 again.

    Sure, a lot of AQ turns into errors because the sample dataset doesn't support Case 2 but the formulas are correct for Case 2's output.

  11. #11
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: change event not triggering macro

    Here is the change event:
    VB
    Please Login or Register  to view this content.
    I think maybe the problem is calculations doesnt exist on the sheet, rater in PERSONNAL.XLSB!.

    Does it need to be called a different way? Your description of what should be happening is correct. Thanks.

  12. #12
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: change event not triggering macro

    Ahhh, the missing information. If the macro you're calling doesn't even exist in the same workbook as the change event you'll have to call it an entirely different way.

    Googled: Excel vb call macro from another workbook

    Result:

    Application.Run ("PERSONALL.xlsm!Calculations")

    This will only work if the workbook you're calling it from is open as well.


    Applied:

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: change event not triggering macro

    I moved the Calculations macro into the this workbook and the change_event is on the annovar sheet (where the A2 change happens): but I have to run calculations manually to get the values. Thanks.

    VB
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: change event not triggering macro

    It is working now, I had the Personal macro open, once I hide that everything is fine. Thank you for your help .

+ 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] Prevent change event triggering when clearing contents
    By tone640 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2012, 09:34 AM
  2. Worksheet Change Event not triggering with cells containing formula
    By Skell in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-15-2012, 06:16 PM
  3. RTD value changes not triggering worksheet change event
    By DTM in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2006, 12:10 PM
  4. [SOLVED] Validation not triggering Change event in Excel XP
    By Jeffrey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-12-2006, 11:40 PM
  5. [SOLVED] Validation not triggering Change event in Excel XP
    By Jeffrey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2006, 10:10 PM

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