Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code for variable criteria
Try using the IsNumeric function in VBA.
-----Original Message----- 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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
can i link a variable cost code with a variable sum | Excel Discussion (Misc queries) | |||
Variable Criteria? | Excel Worksheet Functions | |||
VBA Code - NAME SEVERAL VARIABLE cells | Excel Worksheet Functions | |||
variable code?? | Excel Discussion (Misc queries) | |||
Variable in a VB Code | Excel Programming |