This article will explain the reason that an ambiguous name is detected in VBA.
There are a number of different reasons why this error can occur in VBA. This is usually due to the fact that a variable and a procedure (sub or function) are called the same within the same scope in your code; of you have 2 procedures that have the same name within the same scope.
Variable and Procedure with Same Name
This error also occur if you have a variable and procedure in the same module with the same name.
To resolve the issue, (1) rename either the the variable and then, (2) in the menu, click Debug > Compile VBA Project to make sure your code will compile.
You will know your code is compiled correctly if the compile option is then greyed out.
Duplicate Functions or Sub-Procedures
This error will also occur if you have 2 procedures with the same name in the same module, when you try and compile your code, you will get the compile error – Ambiguous name detected.
Removing one of the procedures or amending the name, and then recompiling the code will once again fix the error.