Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2007

Tip: Looking for answers? Try searching our database.

Need help  with conditional formatting (VBA)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
crisstyd@yahoo.com - 31 Oct 2007 21:45 GMT
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
Don Guillett - 01 Nov 2007 00:22 GMT
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

Signature

Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com

>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.
[quoted text clipped - 9 lines]
> Thanks
> Christina
Chip Pearson - 04 Nov 2007 17:57 GMT
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

Signature

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

>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.
[quoted text clipped - 9 lines]
> Thanks
> Christina

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.