Home > Net >  Excel VBA editor issue
Excel VBA editor issue

Time:09-14

In my years of using Excel VBA I have not seen this before. On a different computer than my usual one, when I type in some code, like the following:

Function Square(x)

   Square=x^2

End Function

Normally the editor will add spaces before and after the equal sign, and spaces before and after the exponent symbol. For the new computer, it does not add the spaces, and it errors because of the lack of spaces. I have to manually add the spaces for it to work, and that slows me down. Any ideas? I assume it is because of some setting, but I can't find it.

CodePudding user response:

Short answer

The reason is a ambiguity of ^ symbol - it's used both, for Exponentiation (e.g. x to power of 2) and Declaring LongLong datatype.

This might be only 64-bit version issue.

While it might not be the answer you expected, to save a bit of time, I suggest using space only before ^ symbol when aiming for exponentiation.

  • Related