Forum Discussion

wiens's avatar
wiens
Brass Contributor
Jun 25, 2025
Solved

Wrong VBA calculation answer

I am getting for a answer -1. It should be +1.

This is calculation error in VBA.

I use this version of VBA:

  • This bug has been resolved. I have done a clean installation of Windows and Office.

4 Replies

  • To pay safe, try this since VBA evaluates ^ before unary minus unless parentheses are used properly

     

    a = (-y) ^ 2

     

    • wiens's avatar
      wiens
      Brass Contributor

      I have tried your method, but the answer is still not correct. I use in Office 365 VBA version 7.1 build 1146.

       

      • wiens's avatar
        wiens
        Brass Contributor

        This bug has been resolved. I have done a clean installation of Windows and Office.

Resources