+ Reply to Thread
Results 1 to 5 of 5

instr returns 0 always

  1. #1
    Registered User
    Join Date
    10-07-2013
    Location
    milton, ON
    MS-Off Ver
    Excel 2007
    Posts
    4

    instr returns 0 always

    I have a couple of issues.

    One of my cells has "53°38′44″N" in it.
    When I use grab the cell value I get "53°38'44?N", also tried cell text, still get the question mark.
    While this is not a big problem, I can work around this.

    I'm attempting to convert the Deg.Hr.Sec to a decimal.

    I'm finding my landmarks, Deg,Hr and Sec. and using the instr function to grab the numbers.
    Please Login or Register  to view this content.
    As you can see I can just change chr(34) to chr(63) and it's no longer an issue.

    But....
    hr and Sec always are 0. Instr never returns their position. Why??

    very confused, how can I find these in the string?

    Ron

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: instr returns 0 always

    Please Login or Register  to view this content.



  3. #3
    Registered User
    Join Date
    10-07-2013
    Location
    milton, ON
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: instr returns 0 always

    thanks, that works nicely. I was going to do it almost the same but a little more stretched out.

    Still curious though why it didn't return the values.

    Ron

  4. #4
    Registered User
    Join Date
    10-07-2013
    Location
    milton, ON
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: instr returns 0 always

    on second look, the seconds returns 53 when I use the value returned from the cell. there is something in the returned value that is messing things up.

    Ron

  5. #5
    Registered User
    Join Date
    10-07-2013
    Location
    milton, ON
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: instr returns 0 always

    I printed out the ascii values of each character in the string, there are no non-printable characters hidden in it.

    53
    51
    176
    51
    56
    39
    52
    52
    63
    78

    yet if I set the string manually it work.

    very confusing.

    Ron

+ 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. InStr function returns pseudo True/False?
    By GCW esq in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-04-2012, 08:00 AM
  2. Instr Function
    By max57 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-01-2010, 03:58 PM
  3. instr and with findnext
    By Chris-79 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2008, 04:01 AM
  4. [SOLVED] InStr
    By Harley in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-09-2005, 04:05 PM
  5. [SOLVED] InStr
    By FGM in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2005, 04:05 PM

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