Basically I am checking several cells in different spreadsheets to see if they contain the correct value. On one sheet I get an error saying: "NullReferenceException was unhandled"
I checked the sheet and it seems ok (it would make check valid return false, but it seemed normal), maybe it has something do to with merged cells, but I didn't see any.
Here is my code:
vb.net Code:
For Each WS In WB.Worksheets CheckValid = True If WS.Range("B4").Value.ToString <> "Employee Name:" Then CheckValid = False End If If WS.Range("H4").Value.ToString <> "Week No.:" Then CheckValid = False End If If WS.Range("F8").Value.ToString <> "Cost" Then CheckValid = False End If ' Add the sheet to the list If CheckValid = True Then CheckedListBox1.Items.Add(WS.Name) End If Next
Just wondering how I would skip to the next sheet if this occurred.




Reply With Quote