Need help with conditional formatting (VBA)

  • Thread starter Thread starter crisstyd
  • Start date Start date
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
 
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
 
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)
 
Back
Top