Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Solution for conditional formatting issue

I hope that I am posting this in the correct area. If not, please let me know
so I don't make the same mistake twice.

Just want to post something that I came up with with the help of several
members of the community here. I needed a way to apply more than 3
conditional formats to a range of cells and base those formatting changes on
the cells contents.
This is the code that I am using to solve this problem. Perhaps something
similar will help someone else in a similar situation.

Private Sub Worksheet_change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("E5:N77")) Is Nothing _
Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
Select Case .Value
Case "Lunch": .Font.ColorIndex = 0
.Interior.ColorIndex = 6
Case "Off": .Font.ColorIndex = 1
.Interior.ColorIndex = 0
Case "Vac": .Font.ColorIndex = 2
.Interior.ColorIndex = 5
Case "Call Off": .Font.ColorIndex = 1
.Interior.ColorIndex = 45
Case "Holiday": .Font.ColorIndex = 0
.Interior.ColorIndex = 44
Case "Meeting": .Font.ColorIndex = 2
.Interior.ColorIndex = 54
Case "Project": .Font.ColorIndex = 2
.Interior.ColorIndex = 10
Case "Training": .Font.ColorIndex = 2
.Interior.ColorIndex = 48
Case "12-9": .Font.ColorIndex = 1
.Interior.ColorIndex = 0
Case "9-6": .Font.ColorIndex = 1
.Interior.ColorIndex = 0

End Select
End With
CleanUp:
Application.EnableEvents = True

End Sub

What this will do is in a specific range of cells in a worksheet, change the
cell color, and font color according to pre-determined text that is placed in
the cell.
Example: If the word "Lunch" is entered in a cell within the range E5 to
V77, that cell would be colored bright yellow and the font would be colored
black.

I would like to thank Bob, Tom, Patrick and any others that I might have
missed for their invaluable input on my dilemna.
I hope that this may help some others out there with similar needs.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Solution for conditional formatting issue

Hi Fleone,
Nice to see an attempt to post a solution waiting for someone with a problem, and it is
a programming thing so you are in the correct group all along.

Relevence of Subject Title:
Based on the wording of the subject title, I would consider this more a
continuation of your thread. The subject might have include the word Event macro
and Conditional Format limit of 3 to be more useful as a subject, since you now
have the advantage of knowing both the problem and the solution.
http://google.co.uk/groups?threadm=0...0microsoft.com

In any case the search engines will find your posting and it is sure to help
several people. Thanks for contributing.
---
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Solution for conditional formatting issue

David,
Thank you for the feedback. I definitely see where this might have been
better posted on my original thread. I will try to keep a better handle on
the subject as well.
Thanks again for the good advice.

Frank Leone

"David McRitchie" wrote:

Hi Fleone,
Nice to see an attempt to post a solution waiting for someone with a problem, and it is
a programming thing so you are in the correct group all along.

Relevence of Subject Title:
Based on the wording of the subject title, I would consider this more a
continuation of your thread. The subject might have include the word Event macro
and Conditional Format limit of 3 to be more useful as a subject, since you now
have the advantage of knowing both the problem and the solution.
http://google.co.uk/groups?threadm=0...0microsoft.com

In any case the search engines will find your posting and it is sure to help
several people. Thanks for contributing.
---
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with conditional formatting The Rook[_2_] Excel Discussion (Misc queries) 2 June 2nd 10 05:36 PM
Conditional Formatting Issue Robert Excel Discussion (Misc queries) 8 September 1st 08 11:05 PM
Conditional Formatting Issue afsoares Excel Discussion (Misc queries) 3 June 30th 06 01:36 PM
conditional formatting issue QUESTION-MARK Excel Worksheet Functions 3 April 20th 06 01:04 AM
Conditional Formatting Issue John Baker Excel Programming 2 July 4th 04 12:52 PM


All times are GMT +1. The time now is 03:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"