If a value exists in a range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to have VBA evaluate the range C3:C100 (name defined as
Type_of_change), and if the value "TEST" exists in any one of those cells,
call Macro A, if not, Call Macro B. How do I get VBA to evaluate the range?

Thanks
Jeff
 
Sub jeffbert()
Set r = Range("C3:C10")
wellisit = False
For Each rr In r
If InStr(rr.Value, "TEST") > 0 Then
wellisit = True
Else
End If
Next
If wellisit Then
Call macroa
Else
Call macrob
End If
End Sub
 
if application.Countif(Range("C3:C100"),"Test") > 0 then
MacroA
else
MacroB
End if

if test is not the sole value of the cell then

if application.Countif(Range("C3:C100"),"*Test*") > 0 then
MacroA
else
MacroB
End if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top