+ Reply to Thread
Results 1 to 4 of 4

Issue using IsNumeric to identify number in cell or array element

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,669

    Issue using IsNumeric to identify number in cell or array element

    Hi,

    i am enclosing a macro. Basically, i create an array in the macro from A1 to A10. I then test the array contents which came from cell A2........where cell A2 is blank. For some reason the array value extracted from cell A2 IS numeric.........but why?

    Any idea?

    Since ISNUMERIC does not seem to do what i want any recommendations on what to do.........i dont want to trim value before storing into array because then values in array will be treated as text i think.

    any good ideas?
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Issue using IsNumeric to identify number in cell or array element

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Issue using IsNumeric to identify number in cell or array element

    Hello welchs101,

    It happens because the cell is Empty. In VBA this ndicates that no beginning value has been assigned to a Variant variable. An Empty variable is represented as 0 in a numeric context or a zero-length string ("") in a string context.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Issue using IsNumeric to identify number in cell or array element

    welchs101

    Thanks for the rep.
    You shuold be very careful in using IsNumeric function.

    It will return True for the data like "1d5" or "1,,,,,5"

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Convert array element to a number
    By Gandalf2524 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-26-2014, 04:48 PM
  2. How to count number of occurences of each element within array
    By cgkmal in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-05-2014, 04:33 PM
  3. Replies: 12
    Last Post: 01-14-2014, 01:56 PM
  4. macro to sum all element in array and output it in one cell of excel.
    By mithil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2010, 04:28 PM
  5. Replies: 4
    Last Post: 05-09-2009, 04:45 AM
  6. [SOLVED] find the index number for an array element
    By Dick Minter in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-20-2006, 07:01 PM
  7. Array problem: Key words-Variant Array, single-element, type mismatch error
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2005, 12:30 AM

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