|
-
Mar 23rd, 2010, 09:46 AM
#10
Thread Starter
Member
Re: dealing with NullReferenceException
 Originally Posted by techgnome
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|