Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can i link a variable cost code with a variable sum I need help!! Excel Discussion (Misc queries) 0 August 1st 08 11:40 AM
Variable Criteria? chris2bc Excel Worksheet Functions 2 November 28th 05 12:17 AM
VBA Code - NAME SEVERAL VARIABLE cells Danny Excel Worksheet Functions 0 October 14th 05 06:15 PM
variable code?? Paul Excel Discussion (Misc queries) 1 April 5th 05 06:37 PM
Variable in a VB Code Michael Kintner Excel Programming 1 January 5th 04 02:29 PM


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"