ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA automatically updating variable names (https://www.excelbanter.com/excel-programming/357619-vba-automatically-updating-variable-names.html)

Mike T[_2_]

VBA automatically updating variable names
 
I defined 2 functions in the same module. One function use lower case 'x' as
the arguement and the other uses upper case 'X' as the arguement(see below).
VBA automatically changes one of the arguements to match the other. It does
the same thing even if I put each of the functions in different modules.

Function fun1(x As Integer)
End Function

Function fun2(X As Integer)
End Function

Can someone please explain this and if I can prevent it? Thanks


Luke Alcatel[_2_]

VBA automatically updating variable names
 
Be more imaginative and use much more descriptive and unique names for your
function parameters.

Luke

"Mike T" <Mike wrote in message
...
I defined 2 functions in the same module. One function use lower case 'x'

as
the arguement and the other uses upper case 'X' as the arguement(see

below).
VBA automatically changes one of the arguements to match the other. It

does
the same thing even if I put each of the functions in different modules.

Function fun1(x As Integer)
End Function

Function fun2(X As Integer)
End Function

Can someone please explain this and if I can prevent it? Thanks




NickHK

VBA automatically updating variable names
 
Mike,
Considering your argument names are meaningless, you could try another
letter of the alphabet.

NickHK

"Mike T" <Mike wrote in message
...
I defined 2 functions in the same module. One function use lower case 'x'

as
the arguement and the other uses upper case 'X' as the arguement(see

below).
VBA automatically changes one of the arguements to match the other. It

does
the same thing even if I put each of the functions in different modules.

Function fun1(x As Integer)
End Function

Function fun2(X As Integer)
End Function

Can someone please explain this and if I can prevent it? Thanks




Zack Barresse[_3_]

VBA automatically updating variable names
 
Hi Mike,

Why not try the popular hungarian-type notation? Here are some examples ...

Type - Variable Name
----------------------------------
Boolean blnWasCreated
String strFileName
Long lngRow
Range rngFilter
Variant varUniqueArray

HTH

Regards,
Zack Barresse



"Mike T" <Mike wrote in message
...
I defined 2 functions in the same module. One function use lower case 'x'

as
the arguement and the other uses upper case 'X' as the arguement(see

below).
VBA automatically changes one of the arguements to match the other. It

does
the same thing even if I put each of the functions in different modules.

Function fun1(x As Integer)
End Function

Function fun2(X As Integer)
End Function

Can someone please explain this and if I can prevent it? Thanks





All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com