Results 1 to 5 of 5

Thread: [RESOLVED] Strange Results from Excel SpreadSheet

  1. #1

    Thread Starter
    Hyperactive Member Vladamir's Avatar
    Join Date
    Feb 2012
    Location
    Miami, FL
    Posts
    486

    Resolved [RESOLVED] Strange Results from Excel SpreadSheet

    I'm getting a very strange result when part of my VB.NET project reads from a particular cell in Excel.
    Code:
    If Mid(vExcelSheet2.Range("B97").Value, 1, 13) <> "THIS HATCH IS" Then
    
                ShutDownExcel()
                Exit Sub
            End If
    I've double and triple checked the contents of B97 on the 2nd sheet of this Excel file and it contains the text "THIS HATCH IS OK". Which gives me the green light to keep going. But it stops and goes to the ShutDownExcel sub instead. When I debug it shows the contents of the cell is an integer with a value of -2146826281. Sounds like someone's phone number in Dallas, TX....(Area Code 214). Anyway, I seem to recall hitting this problem once long ago but cannot recall if this was the same scenario.

  2. #2
    Addicted Member thetimmer's Avatar
    Join Date
    Jan 2014
    Location
    Plano, Texas
    Posts
    243

    Re: Strange Results from Excel SpreadSheet

    check the format type of the cell, make sure it's text
    _____________
    Tim

    If anyone's answer has helped you, please show your appreciation by rating that answer.
    When you get a solution to your issue remember to mark the thread Resolved.


    reference links

  3. #3

    Thread Starter
    Hyperactive Member Vladamir's Avatar
    Join Date
    Feb 2012
    Location
    Miami, FL
    Posts
    486

    Re: Strange Results from Excel SpreadSheet

    It's a formula. But it resolves to a text field.

    Hey, Plano, TX. Very near my home town of Richardson, TX. I know the town well.

  4. #4
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Strange Results from Excel SpreadSheet

    Quote Originally Posted by Vladamir View Post
    I'm getting a very strange result when part of my VB.NET project reads from a particular cell in Excel.
    ....
    When I debug it shows the contents of the cell is an integer with a value of -2146826281.
    I have not seen that particular value before, but I have seen: -2146826246 {Integer}. This is what the NA() function returns as.

    Quote Originally Posted by Vladamir View Post
    It's a formula. But it resolves to a text field.
    Just a guess, but maybe the sheet needs to be recalculated (ie: worksheetref.Calculate())?

    Edit: Just did a test. -2146826281 {Integer} is returned by a cell with a divide by zero error.
    Last edited by TnTinMN; May 20th, 2014 at 08:42 PM. Reason: added info

  5. #5

    Thread Starter
    Hyperactive Member Vladamir's Avatar
    Join Date
    Feb 2012
    Location
    Miami, FL
    Posts
    486

    Re: Strange Results from Excel SpreadSheet

    Thanks everyone for the replies. I finally tracked it down. Someone who shall remain nameless, but he's one of the department heads, decided to rename one of the macros in this particular spreadsheet. Not only did he not tell anyone he did this, but he even forgot that he did it. That's why they call guys like this 'BOSS' because when you spell it backwards you get a 'Double SOB'.

Posting Permissions

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



Click Here to Expand Forum to Full Width