+ Reply to Thread
Results 1 to 10 of 10

Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Question Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    Hello,
    I am not capable to make any Worksheet_Change(ByVal Target As Range) macro works. I tried several of them and none of them works in my Excel 2010. I boiled it down to the simplest version below, I studied several different treads on this forum and still nothing works. Any help is greatly appreciated.

    Please Login or Register  to view this content.
    The file is attached - again it simplified to single page, one cell which should be monitored by the macro.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    So you know, the macro works for me, which leads me to believe it's not a coding issue. Are macros enabled? What are your security settings?

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    You need to enable macros.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    06-13-2013
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    Well, then it is something in my Excel. Macro security is on "Disable all macros with notification". Regular VBA macros work. I just checked - closed and re-open file to enable macros. What it could be?

  5. #5
    Registered User
    Join Date
    06-13-2013
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    I added module with simplest macro

    Please Login or Register  to view this content.
    and it worked, so it is not just disabled macro. I know that I am an idiot but I checked...

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    maybe events are disabled
    run this macro
    Please Login or Register  to view this content.
    and then check your Private Sub Worksheet_Change

  7. #7
    Registered User
    Join Date
    06-13-2013
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    Yes! It worked! How I can make it to work every time?
    More correct question - are there any settings in Excel that do the same thing - Enable events?
    Thank you very much for your help.

  8. #8
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    Nilem,

    Nice thinking. I was stumped! {+ Reputation}

  9. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    Leo,
    it happens when the code contains
    Please Login or Register  to view this content.
    and if the code fails, events are still disabled. But it happens very rarely with the correct codes
    BigBas, thanks

  10. #10
    Registered User
    Join Date
    06-13-2013
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Cannot trigger macro with Worksheet_Change(ByVal Target As Range)

    Nilem,
    Thank you very much for help and explanations. I guess when my earlier versions of code failed, this disabled the events.
    Leo

+ 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