PDA

View Full Version : [SOLVED:] Variable changes its cases.



V.B.A.02
07-20-2017, 03:10 AM
Hello, I am new, so this might have been answered earlier however I could not find it any where answer that's why posting, Help is appreciated..

I have two subs, I am using same variable names to declare a variable but in different cases (lowercase & Mixed) and what i see VBA just makes them similar. See blow:


Sub First()
Dim mystr As String
'Do Something...
End Sub

Sub Second()
Dim MyStr As String
'Do Something
End Sub

here, first 'mystr' gets changed to 'MyStr' by VBA automatically (latest variable changes all previous ones), I am asking this just out of curiosity, want to understand why is it happening, is it normal or I have something different.

Thanks.

YasserKhalil
07-20-2017, 03:15 AM
AFAIK when changing the variable character case at any position in the VBE project, it will be changed automatically in all the project
So if you have this variable mystr in a procedure and used the same variable in another procedure but with different characters (for example : myStr), it will automatically changed to the new one ..

V.B.A.02
07-20-2017, 04:23 AM
Thanks.

YasserKhalil
07-20-2017, 04:25 AM
You're welcome ..