Need help with conditional formatting (VBA)

C

crisstyd

I am trying to figure out how to have a macro run on the active row
and if certain conditions are met then do another function.

Example:

if the active row contains AAA BBB CCC in ANY order of the three
cells, then I need it to move on and do another function.

I hope this makes sense.
Any help is appreciated.

Thanks
Christina
 
D

Don Guillett

One way
Sub ifabc()
Dim i As Long
myarray = Array("aaa", "bbb", "ccc")
For i = 10 To 1 Step -1
If Not IsError(Application.Match(Cells(1, i).Value, myarray, 0)) _
Then mc = mc + 1
Next i
If mc >= 3 Then MsgBox "doit"
End Sub
 
C

Chip Pearson

I don't see where Conditional Formatting fits in, but you could do something
like

If Abs(Not (IsError(Application.Match("aaa", ActiveCell.EntireRow, 0)))) + _
Abs(Not (IsError(Application.Match("bbb", ActiveCell.EntireRow, 0)))) +
_
Abs(Not (IsError(Application.Match("ccc", ActiveCell.EntireRow, 0)))) =
3 Then
Debug.Print "Do your thing"
Else
Debug.Print "Do nothing"
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 

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

Top