Formula for detecting a certain pattern in a particular row or column?

  • Thread starter Thread starter jacky.newsgroup
  • Start date Start date
J

jacky.newsgroup

Hi,

I wonder if there's a formula for detecting a certain pattern in a
particular row or column?

Any of the cells within the range of "start", and "end" would trigger
"do XXX"


Presudo code would be:

If I can see "X" in range(start, end) Then
do XXX
Else
do OOO
End If


Thanks,
Jacky
 
Dim rStart as Range, rEnd as Range
Set rStart = Range("A1")
Set rEnd = rStart.Specialcells(xlLast)
If Application.countif(range(rstart, rend),"X") > 0 Then
XXX
Else
OOO
End If

if X is a substring

If Application.countif(range(rstart, rend),"*X*") > 0 Then

Assumes XXX and OOO are the names of macros in the same module
 
Dim rStart as Range, rEnd as Range
Set rStart = Range("A1")
Set rEnd = rStart.Specialcells(xlLast)
If Application.countif(range(rstart, rend),"X") > 0 Then
XXX
Else
OOO
End If


Hi Tom,

Thanks for the code. I am using Excel 2000, where do I type all these
code in? Currently, I am using short codes in the cells like "=
+COUNTIF(E18:IV101, "O")"
 

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