Breakpoint in Excel VBA not breaking

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ewokspy
    New Member
    • Sep 2007
    • 30

    Breakpoint in Excel VBA not breaking

    Working with Excel 2003, I have a worksheet that I programatically generate from another worksheet. On this worksheet are two events, a selection change event and worksheet_chang e event. The selection change event just forces an application.cal culate. The worksheet change is:

    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    
      'Ensure we are connected to code and disable all events/updating
      If Not StartEvent Then Exit Sub
    
      WBSFinalWorksheetChange Target
      
      'Reenable events/updating
      EndEvent
    
    End Sub
    I know the code runs when the worksheet_chang e should, but if I put a breakpoint on the method header, the code doesn't stop at all. When the code runs, it reaches a command to do a findnext, and never reaches the next line (I used msgbox lines throughout the code to track the codes progress since breakpoints weren't working) There is no error handling in the code, so an error should kick it out, but I think it's a function of the breakpoints not working. Has anyone seem anything like this or have any idea what is going on?
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    I think it's because the 'If Not StartEvent Then Exit Sub'

    perhaps you're always exiting there, so you never reach the code below (the one with the breakpoint)

    now, if your breakpoint is in the EVENT header, well, since that line is not an executable one, it'll never be reached, why dont you put the break point in the first executable line (lets say the 'If Not StartEvent Then' one.

    Comment

    Working...