+ Reply to Thread
Results 1 to 4 of 4

#NAME error from VBA code

  1. #1
    Registered User
    Join Date
    05-26-2007
    Posts
    53

    Question #NAME error from VBA code

    it's been a week since i'm trying to fix this, I'm giving up...

    If I input the formula direct into the cell it works perfect. If I try to use it from a VBA macro I get #NAME error in the cell. However, if after the formula is in place from the VBA code I place the cursor at the end of the formula bar and press enter, without changing anything, the result is correct.
    I tryed 2 codes, one trying to set a variable column in the formula, the other trying to use a set column ("O").
    The first code looks like this:
    Please Login or Register  to view this content.
    where Var4 is an integer, calculated before as the difference between 2 columns. In the formula bar I get something looging like:

    =INDEX(Make!A:A,MATCH("*"&LEFT(O2,3)&"*",Make!B:B,0))
    which looks correct to me, but it gives me the #NAME error.

    The second code looks like:

    Please Login or Register  to view this content.

    When I use this code, in the formula bar I get:

    =INDEX(Make!A:A,MATCH("*"&LEFT('O2',3)&"*",Make!B:B,0))

    (note the 'O2')

    But if I place the cursor at the end of formula bar and press enter, it works right.

    Please, can somebody help?
    Last edited by VBA Noob; 06-02-2007 at 12:07 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Does this help

    Please Login or Register  to view this content.

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    05-26-2007
    Posts
    53
    You gave me back my sleep!

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad it helped

    VBA Noob

+ 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