I'm having a problem getting my message box to return the value of a null cell. Basically on the "BeforeClose" event, I want to check cell B starting with row 14 to see if the cell is blank or if it has something in it, Then I want to cancel the close event. My code doesn't work when there isn't any value in the cell. It doesn't give me my message instead it just cancels the close event. What am I doing wrong? What should the value equal to if the value is blank? Here's my code:
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
For a = 14 To lastrow
If Cells(a,"b").value = "" then
msgbox "nothing in cell"
else
MsgBox Cells(a, "b").Value
end if
Next a
Cancel = True