Hi all. I have written a function that checks the value of a cell and if it is 1 or greater or 0 or less then it changes the value to CVErr(xlErrNA). I do this because these values will later be plotted and I don't want any of the values to show up in the plot. So I wrote the following function.

Function ChangeToErrNA(control As Variant)
If control.Value >= 1 Then
control.Value = CVErr(xlErrNA)
ElseIf control.Value <= 0 Then
control.Value = CVErr(xlErrNA)
End If
End Function

And then used the following bit of code to loop it through each data cell in several worksheets to check each value and change it if need be.

Sub ChangeValues()
Dim b As Long
Dim i As Long
Dim j As Long
Dim m As Long
Dim n As Long
For b = 1 To 1
Worksheets(b).Activate
i = ActiveSheet.UsedRange.Rows.Count
j = ActiveSheet.UsedRange.Columns.Count
For n = 3 To i Step 1
For m = 2 To j Step 1
ChangeToErrNA (Cells(n, m))
Next m
Next n
Next b
End Sub

The data in each cell is the result of the Vlookup function. Some cells already have #N/A as a result of this function. When the loop hits the first of these cells I get a "RunTime Error 13 Type Mismatch" Error and it exits the sub. How do I handle this so that I do not get this error? Is there something different I can do with my function? Thanks in advance.