I have been writing an Excel macro to help me process data at work, and now that I have finished writing the code I keep getting errors because Microsoft Visual Basic keeps changing .Range to .range. Whenever it does this I get a compile error because the method doesn't exist.
Is there anyway to fix this? Is there a way to get around using .Range if there isn't? As long as my code keeps getting changed from .Range to .range it will keep spitting out errors here.
SOLVED: the error wasn't rooted in the method but the data member that preceded it.
Try declaring Range as a Range somewhere in your code (note the case):
Dim Range As Range
then delete the statement.
This should convert all your range
to Range
I have several models and procedures, and at some point all of my Ranges got converted to lowercase range. My easy fix was to go to ThisWorkbook in my project, and Dim Range as Range there, and then it will automatically change "range" to "Range" everywhere it appears in your code
EDIT: The O.P. stated:
SOLVED: the error wasn't rooted in the method but the data member that preceded it.
However, the related issues of a lowercase method can come from creating a variable or routine which you named range
and the system will auto change case based on that definition. You should never create a variable or routine with the same name as a defined process like Range()
.
As mentioned by @RubberDuck:
This is a side effect of VB being case insensitive and the IDE trying to be "helpful".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With