+ Reply to Thread
Results 1 to 12 of 12

trigger event not functioning

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    trigger event not functioning

    Hi,

    I have a

    trigger event..
    this is not working in the specified page for which i have kept..
    Can any one tell me when and why is the trigger event not functioning..
    i have changed column .. but still not working in the worksheet..
    kindly let me know the reason, if you have idea.
    Last edited by dorabajji; 09-01-2019 at 07:22 AM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: trigger event not functioning

    Is the sheet protected?

    Was a cell in column 11+ changed manually?

    If the code in that sheet? Right click sheet tab, View Code.

    Did an error occur?

    Are macros enabled?

    Try closing Excel and reopen.

  3. #3
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486
    Quote Originally Posted by Kenneth Hobson View Post
    Is the sheet protected?

    Was a cell in column 11+ changed manually?

    If the code in that sheet? Right click sheet tab, View Code.

    Did an error occur?

    Are macros enabled?

    Try closing Excel and reopen.
    No sheet not protected.
    Yes unchanged cell manually
    Yes macro enabled
    Workbook has 10+ macro
    I saved and reopened 3 times..
    The event is running in other sheets..
    But not this sheet..
    Am I missing something?

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: trigger event not functioning

    Likely you had an error. Errors need to be handled. The way the code is written, I doubt that you want multiple iterations.

    You can run Application.EnableEvents = True, close and reopen. For a one-off run of one line, I put it in Immediate window and enterkey at end.

    Then use the 2nd sub here. The 1st was my test. I found 78 runs for one change.
    Dim i as Integer
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        i = i + 1
        Debug.Print i, Target.Address
        If Target.Column >= 12 Then Cells(Target.Row, 14) = Target.Value
    End Sub
    
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        On Error Resume Next
        Application.EnableEvents = False
        If Target.Column >= 12 Then Cells(Target.Row, 14) = Target.Value
        Application.EnableEvents = True
    End Sub

  5. #5
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: trigger event not functioning

    Hi,
    there is an existing macro for that cell.. that collides with this trigger event..
    Can this trigger event not start till the original macro finishes?
    is it possible..
    i have given before double click trigger event.

    When an existing macro runs..
    it stops at debugging at the thisworkbooks.select .. because of the trigger event..
    When i delete the event or change it to comments , my macro working properly..
    Why does the events interfere in the macro...
    and also enable events false set
    Last edited by dorabajji; 09-01-2019 at 07:25 AM.

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: trigger event not functioning

    You did not disable events prior to this:
    Sheets("Sheet3").Range("k:p").Delete
    So, for every cell in the used range of K:P, your sheet event fired many times. I doubt that you wanted that.

  7. #7
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: trigger event not functioning

    Kenneth Sir,
    I am not able to get it exactly.. Can you tell me where should i modify, so that i want the macro to run..
    My purpose is to filter the range and copy through macro..
    Then by the event when the user inputs yes/no in the last visible row.. i want to copy it to another column
    How to change that both works fine..

    When the macro runs and stops at debug in thisworkbook.sheet3 line..
    Y is to so?

  8. #8
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: trigger event not functioning

    You have several issues going on. Which do you want to solve first?

    You lost me. For example, in Sheet3, I don't know what you are doing there. Please explain in words.

    You would save yourself a lot of effort if you would use Option Explicit at top of each object: worksheet, module, etc. Then in VBE's Debug menu, Compile before any Run.

    I made a few changes in Sheet3's BeforeDoubleclick code as commented and a bit more. Still, it really doesn't do anything in that sheet.

    'Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range)
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
        Dim lastVisRow As Long, lastRow As Long, rng As Range
        
        'If Target.Column <> 11 Is Nothing Then Exit Sub
        If Target.Column <> 11 Then Exit Sub
        
        lastVisRow = Cells(Rows.Count, 10).End(xlUp).Row
        If Target.Column >= 11 And Target.Row = lastVisRow Then
            Cancel = True 'turn off edit in cell?
            Application.EnableEvents = False
            Selection.AutoFilter    'Selection? What is selected?
            Range("k1").AutoFilter 'Data is only in columns A:B, why filter K1?
            Range("j1:k" & lastRow).AutoFilter Field:=2, Criteria1:="yes" 'No data in those columns
            AutoFilter.Range.Offset(2, -1).Copy Destination:=Range("l1")
            Cells(1).AutoFilter
            Application.EnableEvents = True
        End If
    End Sub

  9. #9
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: trigger event not functioning

    Hi,
    my requirement is filter the school and copy the names corresponding axa/cxa/bxa and then asking the user whether user has completed updation so give yes/no for the same in a separate column .. then the yes are copied and no are deleted..


    For this , since i have not used input box or have limited knowledge in macro, hence i tried a msg box..
    first i filtered and copied the visible rows for the criteria to another column ..
    there in the next column, asked the user to input yes/no
    when last row is entered, either by change or doubleclick automatic copying of yes entries done..

    for this the trigger event was provided by forum user for another query, i modified to my requirement.. so i dont understand where i am going wrong..
    or am i totally wrong..

  10. #10
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,605

    Re: trigger event not functioning

    OP removed code - No tags needed anymore
    Last edited by Pepe Le Mokko; 09-02-2019 at 02:40 AM.

  11. #11
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: trigger event not functioning

    Hi,
    I have attached file..
    In that due to the trigger event,the macro filter is not functioning...
    Attached Files Attached Files

+ 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] Event Trigger Not Working
    By stevewest012 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2018, 11:54 AM
  2. trigger an event if the cel value changes.
    By yoursamrit2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2015, 06:38 PM
  3. [SOLVED] VBA to trigger event change
    By jrholden in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-26-2014, 11:34 AM
  4. beforedoubleclick event does not trigger
    By anneman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-22-2008, 11:49 AM
  5. Event trigger in Excel?
    By Tim Miller in forum Excel General
    Replies: 1
    Last Post: 05-24-2006, 04:10 PM
  6. [SOLVED] Event Trigger
    By lobo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-16-2005, 04:35 PM
  7. [SOLVED] Trigger Event Code
    By Shawn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-14-2005, 10:05 AM

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