lee2smooth03
New Member
- Joined
- Nov 13, 2011
- Messages
- 20
Am I using the right test?
I'm using Range.Rows.Find() to search for a value in the row while looping through a named range. When the code arrives at a row, I want to check to see if an input value is present in the row...the caveat here is that the "Find" function returns a range (the cell) that contains the value...if it's there.
For the purpose of this function, I don't care what the return cell is, I just want to know if the value is present in the row.The IsNull function was used to measure this condition, but I don't think it's working properly because the two variables that were supposed to count the condition keep returning the same value...and they shouldn't
Below is a snippet of my code:
In the conditional statement, how can we check to if the value is in the range/or not in the range?
Thanks for any help
I'm using Range.Rows.Find() to search for a value in the row while looping through a named range. When the code arrives at a row, I want to check to see if an input value is present in the row...the caveat here is that the "Find" function returns a range (the cell) that contains the value...if it's there.
For the purpose of this function, I don't care what the return cell is, I just want to know if the value is present in the row.The IsNull function was used to measure this condition, but I don't think it's working properly because the two variables that were supposed to count the condition keep returning the same value...and they shouldn't
Below is a snippet of my code:
Code:
If IsNull(theData.Rows.Find(item, after:=theData.Cells(rowCount, 1), LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByColumns)) Then
counter = counter + 1
Else
itsHere = itsHere + 1
counter = counter + 1
End If
In the conditional statement, how can we check to if the value is in the range/or not in the range?
Thanks for any help