Results 1 to 13 of 13

Thread: dealing with NullReferenceException

Threaded View

  1. #10

    Thread Starter
    Member
    Join Date
    Mar 2010
    Posts
    58

    Re: dealing with NullReferenceException

    Quote Originally Posted by techgnome View Post
    tisk, tisk, tisk.... the two of you should know better than that...

    dethredic - then what that tells me is that your range is off... you're probably hitting a worksheet with no data. You can't .ToString something that doesn't exist...

    Code:
    If WS.Range("B4") IsNot Nothing AndAlso WS.Range("B4").Value isNot Nothing AndAlso WS.Range("B4").Value.ToString...
    -tg
    You code doesn't work, I get the same error.

    Also I don't think the range is off because the cell B4 is clearly there and says "Employee", and that is where the error occurs. If I comment out the "B4" check, then the "H4" check give me the error, although H4 is merged with G4 so I could understand receiving an error with that cell.
    The final check "F8" does not give me an error...

    EDIT:
    I wrote a quick VBA macro for the spreadsheet:
    Code:
    Sub Test()
        MsgBox (ActiveSheet.Range("b4"))
    End Sub
    That returned "Employee"
    Last edited by dethredic; Mar 23rd, 2010 at 09:50 AM.

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