Is anyone else having problems with VBA making mistakes?

Earnesto 0 Reputation points
2023-03-18T16:42:45.09+00:00

I am running windows 11 on a Laptop and a Desktop with Excel 2019. I run daily macros that I have been creating and improving since before Window XP. In the last year when I started running Windows 11 I have noticed VBA intermittently making mistakes.

I have never had this as far as I can remember before. I have spent a lot of time researching the problem online without any matches.

Either my sanity checks or VBA catches the mistake(s). I use Debug to trace the empty or incorrect data passed to a variable ( Example: NMMProw = WhatEver) to the line in the code where the variable was filled or changed.

I do not need to make any changes to that line of code, The source for the variable is correct (WhatEver) and the variable's (NMMProw) contents is incorrect.

I set that line of code where the mistake happened as the active row and press F5 to have the program continue successfully. I have tried DoEvents at some points in code that seem to recur, but it doesn't seem to help much.

Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
{count} votes

1 answer

Sort by: Most helpful
  1. John Max 15 Reputation points
    2023-03-19T10:58:44.27+00:00

    It's possible that the issue you're experiencing with VBA intermittently making mistakes may be related to changes in how Windows 11 interacts with Excel 2019 or changes in the VBA environment itself. Here are a few steps you can take to try to resolve the issue:

    1. Ensure that your version of Excel is up to date: Make sure that you have installed all the latest updates for Excel 2019. Microsoft regularly releases updates to address issues and improve compatibility with newer operating systems.
    2. Check for compatibility issues: Some older VBA code may not be fully compatible with newer versions of Excel or Windows. Consider checking your VBA code against Microsoft's VBA Compatibility List to ensure that it is compatible with your current setup.
    3. Try running Excel in compatibility mode: If you suspect that compatibility issues may be causing your problems, try running Excel in compatibility mode. Right-click on the Excel shortcut and select Properties, then select the Compatibility tab and choose a previous version of Windows.
    4. Consider using a virtual machine: If all else fails, you may want to consider running Excel within a virtual machine. This can help ensure that your code runs in a stable environment that is not affected by changes in the host operating system.

    Overall, the most likely cause of your issue is changes in how VBA interacts with Windows 11 or Excel 2019. By ensuring that your software is up to date and checking for compatibility issues, you may be able to resolve the issue.

    Regards
    John
    CEO
    Mobiles In BD

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.