Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Apr 2001
    Location
    Arriving Somewhere but not Here
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts

    invalid name for VBA function (XL 97 sr2 on Win 2000 sp2)

    I tried to name my user defined VBA function along the lines of:

    funcnameH15

    but I got a 'that name is not valid' message. It could be that my function just isn't working properly but I wondered if the fact I had used something that looks like a cell reference at the end of the name was causing the problem.

    Any comments?

    (kinda)stuck

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: invalid name for VBA function (XL 97 sr2 on Win 2000 sp2)

    Hi,
    I have no problem with that in XL2002 and as far as I recall there was nothing that would make that an invalid name in previous versions. What is the rest of the function name?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    5 Star Lounger
    Join Date
    Apr 2001
    Location
    Arriving Somewhere but not Here
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: invalid name for VBA function (XL 97 sr2 on Win 2000 sp2)

    Full name is huberH15. I know the core code that crunches the numbers is correct, it works as a Sub, but I'm having fun <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23> wrapping it up as a Function.

    (still, kinda) stuck

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: invalid name for VBA function (XL 97 sr2 on Win 2000 sp2)

    That name works fine as a function name for me (from immediate window and worksheet) - are you sure you don't have any conflicting names? (Though I'd expect an ambiguous name message of that were the problem.)
    Can you post the code in question?
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: invalid name for VBA function (XL 97 sr2 on Win 2000 sp2)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> Stuck

    OK the H15 is not a stand alone name, so I don't think it is getting confused as a cell address. BUT!!! <img src=/S/blush.gif border=0 alt=blush width=15 height=15>

    You will never know. So lets make sure:

    1) Your name is unique and not shared by any other sub, function, variable, UserForm, control object and what have you.

    2) Add something after the H15, say your initials or any text and see what happens.

    Hope this helps...

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  6. #6
    5 Star Lounger
    Join Date
    Apr 2001
    Location
    Arriving Somewhere but not Here
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: invalid name for VBA function (XL 97 sr2 on Win 2000 sp2)

    Thank you Rory and Wassin,

    It is possible that I the name was not unique and was used elsewhere in some scratch code I hadn't cleared out. I have (temporarily) solved the problem by setting aside the implementation of this as a Function. I instead I've been making the the rest of the code do the maths I want correctly, as a Sub.

    I will repost on this thread if this 'invalid name' thing comes back to haunt me but there are other gaps in my VBA knowledge that I need to plug first so I will post my next question as a new thread.

    stuck

Posting Permissions

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