By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

Breakpoint in Excel VBA not breaking

P: 30
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_change event. The selection change event just forces an application.calculate. The worksheet change is:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2.  
  3.   'Ensure we are connected to code and disable all events/updating
  4.   If Not StartEvent Then Exit Sub
  5.  
  6.   WBSFinalWorksheetChange Target
  7.  
  8.   'Reenable events/updating
  9.   EndEvent
  10.  
  11. End Sub
I know the code runs when the worksheet_change 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?
May 23 '08 #1
Share this Question
Share on Google+
1 Reply


kadghar
Expert 100+
P: 1,295
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.
Jun 23 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.