How does one restore default case to a variable in VBA (Excel 2010)?
You need to change the name of the variable in a declaration line (Dim
statement for example) somewhere (anywhere, actually).
This is one of the most annoying "features" of the VBA IDE (as if version control weren't already hard enough with VBA, the constant case-changing drives me batty). Variables have their case changed globally in the VBA IDE, regardless of the variable's actual scope. The VBA IDE seems to take the approach of most recent declaration wins.
Usually all you need to do is just update the case in a declaration line somewhere, but VBA can be obstinate. I've yet to crack the code completely.
Note: As @Scorchio points out in the comments below, the variable case is changed globally within the current project; other projects that may be open in the VBA IDE (such as other workbooks when working in Excel) are NOT affected.
UPDATE: I expanded on this entry in my Access/VBA blog today: VBA's Case Changing "Feature"
Last declaration in time wins.
- Go on first line and type
Dim Range As String
- Move to next line
- Go back and remove your
Dim Range As String