I'm iterating through a range of cells which hold numbers with 2 decimal places. I need to check if the cell holds '#N/A', and if it does, I need to skip it. The problem is, when a cell holds a valid number, my if condition below throws a 'Type mismatch error'. How can I avoid this?
If (ActiveWorkbook.Sheets("Publish").Range("G4").offset(offsetCount, 0).Value <> CVErr(xlErrNA)) Then
'do something
End If
'Checkin someone out' definitely has meaning (as in, looking at or sizing someone up as as a potential love/attraction interest, or just examining up and down at how someone looks if they are attractive), but her saying "checkin' for" here makes me think it means something else.
/tʃek/ to find out what someone is doing in order to make certain that the person is behaving correctly or legally: Dad is always checking up on me to make sure I'm doing my homework.
Check in, without a hyphen, is an action verb and denotes your action of checking in somewhere or, checking in on something. Check-in, with a hyphen, refers to either a place or time where you do your checking in and can be used either as a noun or adjective.
First check for an error (N/A value) and then try the comparisation against cvErr(). You are comparing two different things, a value and an error. This may work, but not always. Simply casting the expression to an error may result in similar problems because it is not a real error only the value of an error which depends on the expression.
If IsError(ActiveWorkbook.Sheets("Publish").Range("G4").offset(offsetCount, 0).Value) Then
If (ActiveWorkbook.Sheets("Publish").Range("G4").offset(offsetCount, 0).Value <> CVErr(xlErrNA)) Then
'do something
End If
End If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With