Currently have a macro with a lot of If statments which goes through each row and tests for certain conditions. One of the conditions which needs to be added to every if statement is the following: If c1 (which I have Dim'd as a range) = "#N/A"). After asking a few people, I finally got the correct line of code to add before each of my if statements as another condition it is:
If CVErr(cl.Value) = CVErr(xlErrNA) And
Unfortunately this keeps messing up when the cl.Value was something NOT "#N/A". I wanted to see if there was a way to maybe start off the macro such as Do While or something that starts it off by testing to see if cl.Value is "#N/A" and if it is go through all the other IF statements and if not go to the next cell. Please advise. Thanks for your help.
Here is just a quick example/peek at 4 If statements which I have added the above line which tests for "#N/A" which brings up the error (Says 13: type mismatch).
For Each cl In range("A2", range("A" & Rows.count).End(xlUp)) If CVErr(cl.Value) = CVErr(xlErrNA) And _ cl.Offset(, 11).Value = "Bond Deals" And cl.Offset(, 2).Value Like "*CLO*" Then cl.Value = "CLO" End If If CVErr(cl.Value) = CVErr(xlErrNA) And cl.Offset(, 11).Value = "Bond Deals" And cl.Offset(, 12).Value Like "BCC*" Then c1.Value = "CLO" End If If CVErr(cl.Value) = CVErr(xlErrNA) And _ cl.Offset(, 11).Value = "Bond Deals" And cl.Offset(, 14).Value Like "*CLO*" Then c1.Value = "CLO" End If If CVErr(cl.Value) = CVErr(xlErrNA) And _ cl.Offset(, 11).Value = "Bond Deals" And cl.Offset(, 15).Value Like "*CLO*" Then c1.Value = "CLO" End If