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

________________

7 thoughts on “Excel VBA Problem With Step Into F8”

  1. To prevent errors in the process of adapting the registry, use this (1-liner !) VBA-code

    [code]Sub M_snb()
    CreateObject(“Wscript.shell”).regwrite “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VBA\DisableOrpcDebugging7”, 1, “REG_DWORD”
    End Sub[/code]

  2. This happens to me sometimes when opening another spreadsheet. F8 steps through the code until the line of code that opens another spreadsheet and then executes all remaining macro code without stepping through.

    Simple solution is to put a stop break on the first line of code after the line of code that opens the spreadsheet – highlight line of code and press F9.

    The continue to step through the code with F8

    Highlight line of code and press F9 to remove the break.

  3. Microsoft seem to have taken out a lot of functionality from excel and word via code. This decision by them to stop f8 and step through code is awful as I have lots of via coding that I need to step through to see what is no longer working. They also keep changing where functions are in the ribbon and seem to be hiding things in odd places. This seems to change almost daily as forced updates occur. This is losing me 2-3 hrs a day trying to resolve theses changes, and not all can be resolved. I used to use office purchased rather than subscription, but was forced to change to office 365 subscription when they stoped supporting calendar sharing in the purchased version. Now they mess about with it I have to question using office and all Microsoft software. Will probably cancel all subscriptions and move to a different os, certainly not windows11. Can’t trust Microsoft anymore.

  4. My registry did not have Microsoft\VBA key registered, so I created one, added the DWORD and set the value to 1 and it solved my problem. Thank you for that.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.