+ Reply to Thread
Results 1 to 9 of 9

VBA editor replaces 'Range' with 'range'

  1. #1
    peter
    Guest

    VBA editor replaces 'Range' with 'range'

    In several Modules or Class Modules if I add a new line
    "Dim r As Range",
    the 'R' changes to 'r' when I press Enter.

    Auto Syntax Check is not enabled.

    I can't think of any changes I've made to the IDE
    that could cause this.

    Thanks for your help,
    Peter.




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

  2. #2
    Greg Wilson
    Guest

    RE: VBA editor replaces 'Range' with 'range'

    I was able to replicate your problem by creating a variable with the name
    "range" and declaring it as type "Range" - i.e. "Dim range As Range". I also
    experimented with making it public - i.e. "Public range As Range". I don't
    know if making it public was necessary. I don't think so.

    Having done this, I can't make the problem go away either. I tried:
    1) Deleting all the modules and recreating
    2) Rebooting
    3) Declaring a variable as "Range" publicly, with the Dim statement in a
    class module as well as at module level in a standard module and at procedure
    level in a standard module.
    4) Unselecting Auto Syntax Check and other options

    None of the above worked - i.e. the capital "R" always changes to lower case
    "r". I guess it's a bug.

    I did find that it is workbook specific. Also note that variables so
    declared still seem to be recognized as of "Range" data type because an error
    is generated if you don't use the Set statement.

    Couldn't find a solution but I believe I found the cause. Hope this was of
    some help.

    Regards,
    Greg


    "peter" wrote:

    > In several Modules or Class Modules if I add a new line
    > "Dim r As Range",
    > the 'R' changes to 'r' when I press Enter.
    >
    > Auto Syntax Check is not enabled.
    >
    > I can't think of any changes I've made to the IDE
    > that could cause this.
    >
    > Thanks for your help,
    > Peter.
    >
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    >


  3. #3
    NickHK
    Guest

    Re: VBA editor replaces 'Range' with 'range'

    Peter,
    What happens if you type:
    Dim r As Excel.range

    NickHK

    "peter" <[email protected]> wrote in message
    news:etXUlR#[email protected]...
    > In several Modules or Class Modules if I add a new line
    > "Dim r As Range",
    > the 'R' changes to 'r' when I press Enter.
    >
    > Auto Syntax Check is not enabled.
    >
    > I can't think of any changes I've made to the IDE
    > that could cause this.
    >
    > Thanks for your help,
    > Peter.
    >
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!




  4. #4
    Greg Wilson
    Guest

    Re: VBA editor replaces 'Range' with 'range'

    I tried that in my experiments also but forgot to mention it. "Excel.Range"
    becomes "Excel.range" and if you type "Excel.range" it is accepted unchanged.

    Regards,
    Greg

    "NickHK" wrote:

    > Peter,
    > What happens if you type:
    > Dim r As Excel.range
    >
    > NickHK
    >
    > "peter" <[email protected]> wrote in message
    > news:etXUlR#[email protected]...
    > > In several Modules or Class Modules if I add a new line
    > > "Dim r As Range",
    > > the 'R' changes to 'r' when I press Enter.
    > >
    > > Auto Syntax Check is not enabled.
    > >
    > > I can't think of any changes I've made to the IDE
    > > that could cause this.
    > >
    > > Thanks for your help,
    > > Peter.
    > >
    > >
    > >
    > >
    > > *** Sent via Developersdex http://www.developersdex.com ***
    > > Don't just participate in USENET...get rewarded for it!

    >
    >
    >


  5. #5
    peter
    Guest

    Re: VBA editor replaces 'Range' with 'range'

    UPDATE

    What prob. caused it was that I defined the name of a Property
    method to be 'range'.

    I've removed that and changed every other 'range' and there's
    no sign of any in the Locals page.

    But I've still got the problem, even after restarting VBA.

    I didn't specifically say, but it's changed ALL my Ranges!

    I sure hope someone can help, as I'm dead in the water
    like this.

    ciao,
    Peter




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

  6. #6
    NickHK
    Guest

    Re: VBA editor replaces 'Range' with 'range'

    Greg,
    Check the references and their order for the workbook. Any marked as missing
    ?
    After typing "Excel." (with the full stop), what do you see ?

    NickHK

    "Greg Wilson" <[email protected]> wrote in message
    news:[email protected]...
    > I tried that in my experiments also but forgot to mention it.

    "Excel.Range"
    > becomes "Excel.range" and if you type "Excel.range" it is accepted

    unchanged.
    >
    > Regards,
    > Greg
    >
    > "NickHK" wrote:
    >
    > > Peter,
    > > What happens if you type:
    > > Dim r As Excel.range
    > >
    > > NickHK
    > >
    > > "peter" <[email protected]> wrote in message
    > > news:etXUlR#[email protected]...
    > > > In several Modules or Class Modules if I add a new line
    > > > "Dim r As Range",
    > > > the 'R' changes to 'r' when I press Enter.
    > > >
    > > > Auto Syntax Check is not enabled.
    > > >
    > > > I can't think of any changes I've made to the IDE
    > > > that could cause this.
    > > >
    > > > Thanks for your help,
    > > > Peter.
    > > >
    > > >
    > > >
    > > >
    > > > *** Sent via Developersdex http://www.developersdex.com ***
    > > > Don't just participate in USENET...get rewarded for it!

    > >
    > >
    > >




  7. #7
    Greg Wilson
    Guest

    Re: VBA editor replaces 'Range' with 'range'

    None are listed as missing. When I type either "Excel." or "Dim abc As
    Excel." the AutoList Members list appears. "Range" is included in the list.
    When I select this, after it is automatically inserted, it then changes to
    "range".

    Regards,
    Greg

    "NickHK" wrote:

    > Greg,
    > Check the references and their order for the workbook. Any marked as missing
    > ?
    > After typing "Excel." (with the full stop), what do you see ?
    >
    > NickHK
    >
    > "Greg Wilson" <[email protected]> wrote in message
    > news:[email protected]...
    > > I tried that in my experiments also but forgot to mention it.

    > "Excel.Range"
    > > becomes "Excel.range" and if you type "Excel.range" it is accepted

    > unchanged.
    > >
    > > Regards,
    > > Greg
    > >
    > > "NickHK" wrote:
    > >
    > > > Peter,
    > > > What happens if you type:
    > > > Dim r As Excel.range
    > > >
    > > > NickHK
    > > >
    > > > "peter" <[email protected]> wrote in message
    > > > news:etXUlR#[email protected]...
    > > > > In several Modules or Class Modules if I add a new line
    > > > > "Dim r As Range",
    > > > > the 'R' changes to 'r' when I press Enter.
    > > > >
    > > > > Auto Syntax Check is not enabled.
    > > > >
    > > > > I can't think of any changes I've made to the IDE
    > > > > that could cause this.
    > > > >
    > > > > Thanks for your help,
    > > > > Peter.
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > *** Sent via Developersdex http://www.developersdex.com ***
    > > > > Don't just participate in USENET...get rewarded for it!
    > > >
    > > >
    > > >

    >
    >
    >


  8. #8
    Dick Kusleika
    Guest

    Re: VBA editor replaces 'Range' with 'range'

    Peter

    All you need to do is create a variable with the capitalization you want.
    Then delete it.

    Dim Range

    the delete it. Now

    Dim x As Range

    will be capitalized how you expect.

    When you create a variable (or property, in your case) that is a keyword,
    VBA remembers the capitalization even after you delete the
    variable/property. This just tricks into doing it right.


    --
    **** Kusleika
    Excel MVP
    Daily Dose of Excel
    www.*****-blog.com



    peter wrote:
    > UPDATE
    >
    > What prob. caused it was that I defined the name of a Property
    > method to be 'range'.
    >
    > I've removed that and changed every other 'range' and there's
    > no sign of any in the Locals page.
    >
    > But I've still got the problem, even after restarting VBA.
    >
    > I didn't specifically say, but it's changed ALL my Ranges!
    >
    > I sure hope someone can help, as I'm dead in the water
    > like this.
    >
    > ciao,
    > Peter
    >
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!




  9. #9
    peter
    Guest

    Re: VBA editor replaces 'Range' with 'range'

    That's great, thanks ****.


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1