Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Conditional formatting (Excel 97)

(Excel 97)
I'm making a schedule template, and I'd like to use more than 3 conditional
formats to color code certain fields (vacation, sick, training, holiday,
etc.)

Also, I am using a data validation list to make it easier for the users to
just click in the appropriate entries. I'd like certain entries in one color
(such as holiday or vacation in blue background) and others in different,
various colors (training in green, for example). Only certain fields should
be formatted like this, and a free text entry should remain in the default
format.

I have some code working, but it appears that the items entered from the DV
list won't drive the vb formatting...

Private Sub Worksheet_Change(ByVal Target As Range)
Set InRange = Intersect(ActiveSheet.Range("A1:A10, D1:100"), Target)

If Not InRange is Nothing then
If Target.Value = "A" Then
Target.Interior.ColorIndex = 3
ElseIf Target.Value = "B" Then
Target.Interior.ColorIndex = 4
ElseIf Target.Value = "C" Then
Target.Interior.ColorIndex = 5
End If
End if
End Sub

I sure would appreciate any help to make it easier.

Thanks in advance!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Conditional formatting (Excel 97)

Debra Dalgleish has this note at:
http://www.contextures.com/xlDataVal08.html:

In Excel 97, selecting an item from a Data Validation dropdown list
does not trigger a Change event, unless the list items have been typed in
the Data Validation dialog box. In this version, you can add a button to
the worksheet, and run the code by clicking the button. To see an
example, go to the Sample Worksheets page, and under the Filters
heading, find Product List by Category, and download the
ProductsList97.xls file.

So if possible, can you just type the list into that Data|validation dialog?
(there is a limit on the total length of that entry, though.)

Bob Wall wrote:

(Excel 97)
I'm making a schedule template, and I'd like to use more than 3 conditional
formats to color code certain fields (vacation, sick, training, holiday,
etc.)

Also, I am using a data validation list to make it easier for the users to
just click in the appropriate entries. I'd like certain entries in one color
(such as holiday or vacation in blue background) and others in different,
various colors (training in green, for example). Only certain fields should
be formatted like this, and a free text entry should remain in the default
format.

I have some code working, but it appears that the items entered from the DV
list won't drive the vb formatting...

Private Sub Worksheet_Change(ByVal Target As Range)
Set InRange = Intersect(ActiveSheet.Range("A1:A10, D1:100"), Target)

If Not InRange is Nothing then
If Target.Value = "A" Then
Target.Interior.ColorIndex = 3
ElseIf Target.Value = "B" Then
Target.Interior.ColorIndex = 4
ElseIf Target.Value = "C" Then
Target.Interior.ColorIndex = 5
End If
End if
End Sub

I sure would appreciate any help to make it easier.

Thanks in advance!


--

Dave Peterson

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
CONDITIONAL FORMATTING- EXCEL Alicia-Paris[_2_] Excel Discussion (Misc queries) 5 May 12th 10 01:16 PM
EXCEL Conditional Formatting HANK Excel Discussion (Misc queries) 3 June 19th 09 05:38 PM
Excel- Conditional Formatting [email protected] Excel Worksheet Functions 3 January 30th 09 09:16 PM
Excel and Conditional formatting Calibutterfly Excel Discussion (Misc queries) 1 January 16th 08 03:38 AM
Excel 07 Conditional Formatting Help! [email protected] Excel Worksheet Functions 4 September 29th 07 12:54 AM


All times are GMT +1. The time now is 12:05 AM.

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

About Us

"It's about Microsoft Excel"