wgmcgowan
wgmcgowan

Reputation: 119

Code occasionally autocorrects to lowercase letters when it seems it shouldn't

Occasionally, VBA autocorrects code I have written with upper case letters to lower case letters. This seems to happen the most with the letters C and R, though in very specific circumstances.

For example, VBA likes to autocorrect [C1].Value to [c1].Value, whilst .Row frequently autocorrects to .row. These are two phrases I have used frequently in a project at the moment and consistently autocorrect.

However, typing .Count, for example, does not result in a correction. As for R, I'm afraid I can't think of an equivalent example...

Is there a clear reason why VBA does this? My results never seem to be affected by these corrections, though I wonder if there are any situations where there would be a clear difference between .Row and .row.

Upvotes: 1

Views: 763

Answers (1)

Samuel Hulla
Samuel Hulla

Reputation: 7089

Truth be told, it doesn't really matter, because is case insensitive.

  • So expression.Row and expression.row are evaluated the same thing

  • As to why, as others pointed out in the comments, it's most likely because you used a variable/procedure/object/module/class/userform with the same name (eg. row, but lowercase) - which in itself is not the best programming practice and should be avoided if possible.

  • Additionally an important note to make, if you declared something with lowercase, it will persist auto-correcting to lowercase even after you remove the declaration. (Sigh.. thank you Microsoft). To fix this behaviour, re-declare the variable (or something else) with upper-case and then remove the declaration again.

Upvotes: 2

Related Questions