+ Reply to Thread
Results 1 to 13 of 13

Worksheet_change will not run automatically

  1. #1
    Registered User
    Join Date
    09-14-2011
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    6

    Worksheet_change will not run automatically

    I cannot get either worksheet_change or worksheet_calculate to fire upon a change in a worksheet. I haven't found the answer on any forum. I created a dummy file to fire a goal seek automatically (also tried firing a simple msgbox, which didn't work either).

    My settings are:

    - Enable all macros
    - Trust access to the VBA project object model

    I inserted the code with a right click on the worksheet I was in, so I think it's in the right place. Also, my goal seek runs correctly if I click F5 in the code. I just can't get this to run on a worksheet change.

    I'm new to VBA, though I'm pretty sophisticated with Excel otherwise. Any help would be greatly appreciated. My code is as follows:

    Please Login or Register  to view this content.
    Last edited by Aydrian13; 09-14-2011 at 03:35 PM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Worksheet_change will not run automatically

    Try
    Please Login or Register  to view this content.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    09-14-2011
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Worksheet_change will not run automatically

    I should have mentioned I tried this in the past, and just tried it again, pasting your code. Still doesn't fire.

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Worksheet_change will not run automatically

    It's possible that Enable Events is false, try
    Please Login or Register  to view this content.
    . You can place this under your Worksheet change procedure and then run it. After you do that try running your code in the change event again. If it still doesn't work, try
    Please Login or Register  to view this content.
    Last edited by Mordred; 09-15-2011 at 01:54 AM.

  5. #5
    Registered User
    Join Date
    09-14-2011
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Worksheet_change will not run automatically

    I pasted and still get the same behavior. Won't run automatically. Runs correctly if I hit F5 in the code.

  6. #6
    Registered User
    Join Date
    09-14-2011
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Worksheet_change will not run automatically

    Happy to post the workbook if that would help. How do i do that - i don't see a link to upload a file?

  7. #7
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Worksheet_change will not run automatically

    On your next post, click "Go Advanced" and then look for the paperclip icon and follow the prompts.

  8. #8
    Registered User
    Join Date
    09-14-2011
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Worksheet_change will not run automatically

    posting workbook
    Attached Files Attached Files

  9. #9
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Worksheet_change will not run automatically

    It was as I thought, you placed the worksheet change procedure in a standard module when it needs to be placed in a worksheet module. In the vbe of the uploaded workbook (from me), double click Sheet1 under "Microsoft Excel Objects" and you'll see the code there and working.
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Worksheet_change will not run automatically

    Works for me as posted!
    Are you changing the value in C8, otherwise it already has the answer in C4?

  11. #11
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Worksheet_change will not run automatically

    Quote Originally Posted by barryleajo View Post
    Works for me as posted!
    Are you changing the value in C8, otherwise it already has the answer in C4?
    I can't see how it could have worked as posted if the Worksheet change event wasn't placed in the worksheet module. Just sayin!

  12. #12
    Registered User
    Join Date
    09-14-2011
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Worksheet_change will not run automatically

    Thanks for the help. Is it me or is it misleading that right clicking on the specific worksheet, and adding the module, doesn't actually give you a worksheet-specific module? I will have to read up to better understand the distinction.

    It works perfectly now, so I can apply this knowledge to my monster spreadsheet. Much appreciated!

  13. #13
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Worksheet_change will not run automatically

    @Mordred
    A case of more haste less speed at my end ..
    Its just a simple formula in C4
    Must pay more attention!

+ 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