Code for variable criteria
Excel 2002, WinXP
The macro below demonstrates what I need but my actual situation is this:
I search a column of 100+ strings for any one of 6 strings.
I find one of the 6 strings.
Using a Select Case construct I define a numerical criteria with which to
test the cell to the right of the found cell. The Select Case construct is
based on which of the 6 strings was found.
This numerical criteria is in the form of a string, i.e., "=10" or "=0" or
"<=0" or similar.
My question is: How do I apply that string criteria to test the cell
content?
I can easily change virtually anything in how I am doing this. Thanks for
your help. Otto
Sub Test()
Dim i As Range
Dim Crit As String
Set i = [A1] 'Found cell
Crit = "=10" 'From the Select Case
If i.Offset(, 1) ?????? Then
MsgBox "Yes"
Else
MsgBox "No"
End If
End Sub
|