excel - Type mismatch when checking cells for error -
if cell (i, 4). Value = xlErrNA then exit the MsgBox ("Error on the line" & amp; i) End End if I think I am setting this if the statement is wrong I " #N / A "and also got the same failure. Any guidance?
An error type can not be compared with the string / numeric type, because they are two different Data of First, you need to check the error:
If IsError (cell (i, 4) Value) then if the cell (i, 4). If value = sever (XLAARA) then MSBBC ("Error in the line" & amp; i) ends with sub-end if note that IsError Also error value, while your = xlErrNA only checks for a specific error: # N / A . The CVErr function changes the enumerated constant xlErrNA (which is a long / numeric value) to its error-type. You may have to add other error types #REF! Other conditions for "Name", #Name! , etc., or you can only leave if the cell (i, 4). Value = xlErrNA and then it will handle any error values. If the IERR (Cell (i, 4). Value) then MSBBX ("Error on the line" & amp; i) Exit the sub end if
Comments
Post a Comment