ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA-Error Message Assistance Needed (https://www.excelbanter.com/excel-programming/360479-vba-error-message-assistance-needed.html)

MLS7181

VBA-Error Message Assistance Needed
 
Exclaimation Point in Yellow Yeild Sign Compile error:
Ambiguous name detected: UpdateOffsetPositions.



Jim Thomlinson

VBA-Error Message Assistance Needed
 
As a guess you have two procedures in the same module with the name
"UpdateOffsetPositions".
--
HTH...

Jim Thomlinson


"MLS7181" wrote:

Exclaimation Point in Yellow Yeild Sign Compile error:
Ambiguous name detected: UpdateOffsetPositions.



Zone

VBA-Error Message Assistance Needed
 
This usually means that two instances of the name are in scope. I've
had this when I created a variable as global and then again in a
procedure. Use find to search for duplicate Dim statements of the same
name


Jim Thomlinson

VBA-Error Message Assistance Needed
 
Are you sure about that... That kind of a scope issue will resolve itself
according to a heirarchy. For example you can dim a variable myVar as a
Global and also dim myVar within a procedure and it will work just fine.
Within the procedure where myVar is declared the local will supercede the
global.

Agreeably within a procedure you can not declare two varaibles with the same
name, nor can you declare two globals with the same name in the same module.
--
HTH...

Jim Thomlinson


"Zone" wrote:

This usually means that two instances of the name are in scope. I've
had this when I created a variable as global and then again in a
procedure. Use find to search for duplicate Dim statements of the same
name



Zone

VBA-Error Message Assistance Needed
 
Jim, I always use the Option Explicit. If I declare a local variable
with the same name as a global variable (including capitalization), I
get this message. Gosh, am I wrong about this?
James


Dave Peterson

VBA-Error Message Assistance Needed
 
I've never had any trouble with common local and global names (but I do try to
avoid that).

Any chance you have multiple procedures using that same sub/function name?

How about the module name? I wouldn't use a sub/function name for the module
name, either.

Zone wrote:

Jim, I always use the Option Explicit. If I declare a local variable
with the same name as a global variable (including capitalization), I
get this message. Gosh, am I wrong about this?
James


--

Dave Peterson

Zone

VBA-Error Message Assistance Needed
 
Dave is right and I am wrong. A local and global variable with the
same name will not cause the problem. But two procedures with the same
name will cause the problem.


Jim Thomlinson

VBA-Error Message Assistance Needed
 
The declaration is valid and the scope expands outwards from the procedure to
the module to the project. That being said it is generaly poor coding
practice to use the same name for a global and a local variable.
--
HTH...

Jim Thomlinson


"Zone" wrote:

Dave is right and I am wrong. A local and global variable with the
same name will not cause the problem. But two procedures with the same
name will cause the problem.




All times are GMT +1. The time now is 08:01 PM.

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