ThrottleWorks
Excel Ninja
Hi,
I have a macro with me. Not developed by me.
There is a variable defined in this macro.
Dim MyString as string.
This is not defined at the start of the Sub.
There are various code lines written before this declaration and various lines post this line too.
If I try to run this code, I get a bug saying, Compile Error: Duplicate declaration in current scope
If I blocked this code line macro runs without any issue.
My doubt is, I was not able to find 'MyString' variable more than once in the entire code.
So as per my logic, when it is written only once then macro should not say it is duplicate.
I tried searching this variable in the entire code, not only in that particular module.
But could not find more than one occurrence.
When blocked, macro runs perfectly, not able to understand why.
In fact am facing same issue for 3 more variables in the same code.
Gave only one here for example. Other variables than these 4 are working good, it is not like am facing same issue for all the variables.
Can anyone please help me in this.
I have a macro with me. Not developed by me.
There is a variable defined in this macro.
Dim MyString as string.
This is not defined at the start of the Sub.
There are various code lines written before this declaration and various lines post this line too.
If I try to run this code, I get a bug saying, Compile Error: Duplicate declaration in current scope
If I blocked this code line macro runs without any issue.
My doubt is, I was not able to find 'MyString' variable more than once in the entire code.
So as per my logic, when it is written only once then macro should not say it is duplicate.
I tried searching this variable in the entire code, not only in that particular module.
But could not find more than one occurrence.
When blocked, macro runs perfectly, not able to understand why.
In fact am facing same issue for 3 more variables in the same code.
Gave only one here for example. Other variables than these 4 are working good, it is not like am facing same issue for all the variables.
Can anyone please help me in this.