Excel VBA Problem With Step Into F8

After you record or write a macro in Excel, you can run the macro, or go slowly through it, line by line, to see if it is working correctly. I use the F8 key, in the Visual Basic Editor, if I’m troubleshooting a macro, to see where something is going wrong. You can use also use the Step Into command, in the VBE’s Debug menu.

f8problemfix04

However, for the past few months, something was going wrong with the “Step Into” command in Excel 2010, whether I used the menu, or the F8 key.

Code Doesn’t Stop

In some macros, especially if the code opened another Excel file, when I pressed the F8 key, the code ran to the end of the macro, instead of stopping at the next line of code. That made it very difficult to troubleshoot the code!

It could also cause other inconvenient or embarrassing problems, if the macro was designed to update files, or send out emails. You don’t want that kind of thing happening at the wrong time.

As a workaround, I could add breakpoints in the code, and it would stop there. Unfortunately, I didn’t always know when the F8 problem might occur, so I didn’t add the breakpoints in every procedure, before trying to step through it.

I searched Google, to see if anyone had a solution for the “F8 runs to the end of the macro” problem, but couldn’t find anything. There were other people complaining about the same thing, but nothing to fix the problem.

Finally a Solution Found

Finally, my friend, Ross Connell, found a solution last week, and kindly shared it with me. Ross spent a long time communicating with Microsoft’s tech support, about this and a couple of other issues, and someone there suggested this fix.

The suggestion is not documented on the Microsoft website though, so don’t take this as an official recommendation from them. However, making this change fixed the problem for me, and for Ross. If you’re comfortable in making a change to your Windows Registry, you can try it too, at your own risk.

Change the Registry

To fix this problem, you can add a new DWORD in the Registry. It’s easy to do, but as always, when working in the Registry, be careful!

I’ve outlined the steps on my website, and you can see the details here. Read the warnings carefully – you can mess things up if you aren’t careful when making a change in the Windows Registry.

On my computer, I’ve got 32-bit Office installed, on a 64-bit system, and below is a screen shot of the DWORD as I added it.

If you had the F8 problem, and tried this solution, please let me know your results, in the comments. Thanks!

f8problemfix02

________________