+ Reply to Thread
Results 1 to 5 of 5

#NAME? value

  1. #1
    Registered User
    Join Date
    04-10-2014
    Location
    Tallahassee, FL
    MS-Off Ver
    Excel 2010
    Posts
    98

    #NAME? value

    I have been writing some code to replace leading and trailing spaces in cells in a workbook and one of the incoming pieces of data (that I cannot control) has the #NAME? value in the cell.

    Needless to say, the code can't remove any spaces from it because its value isn't a string. The problem is I cannot figure out how to write the code to remove those entries because I can't identify it.

    What is the "#NAME?" value as VB can identify it?

    Please Login or Register  to view this content.
    The above does not work, because it isn't a string with the value, so I am trying to find out what the value is and cannot seem to Google it.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: #NAME? value

    Please Login or Register  to view this content.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    04-10-2014
    Location
    Tallahassee, FL
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: #NAME? value

    Thank you, I knew it was something simple I was overlooking.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: #NAME? value

    FYI, VBA has a native IsError function.

    If they are error values, rather than formulas, you could also replace them all in one pass using:
    Please Login or Register  to view this content.
    before you run your loop (which you could probably also replace with a call to Application.Trim).
    Last edited by romperstomper; 09-25-2014 at 09:29 AM.
    Remember what the dormouse said
    Feed your head

  5. #5
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: #NAME? value

    Romperstomper, i tried the VBA.IsError at 1st and it was returning false. Just tried again and it returns true

+ 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