Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional Formatting Help!

I need to apply CF macro to my 2003 since I need to have 5
conditions. I know that I can download addins but I am working from a
secure network without internet access.

The range is A1:CM190. Here are my conditions

If the cell value is 1, then the font and internior color index is 6
'yellow'
If the cell value is 2, then the font and internior color index is 46
'Orange'
If the cell value is 3, then the font and internior color index is 37
'blue'
If the cell value is 4, then the font and internior color index is 5
'Dark blue'
If the cell value is 5, then the font and internior color index is 3
'red'

Any help I can get is highly appreciated!!!

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Conditional Formatting Help!

Paste the following event code into the code module for the sheet where you
want this formatting to occur:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("A1:CM190")) Is Nothing Then Exit Sub
Select Case Target.Value
Case 1
Target.Font.ColorIndex = 6
Target.Interior.ColorIndex = 6
Case 2
Target.Font.ColorIndex = 46
Target.Interior.ColorIndex = 46
Case 3
Target.Font.ColorIndex = 37
Target.Interior.ColorIndex = 37
Case 4
Target.Font.ColorIndex = 5
Target.Interior.ColorIndex = 5
Case 5
Target.Font.ColorIndex = 3
Target.Interior.ColorIndex = 3
Case Else
Target.Font.ColorIndex = xlColorIndexAutomatic
Target.Interior.ColorIndex = xlColorIndexAutomatic
End Select
End Sub

By setting the font colorindex and the interior colorindex to the same
value, you can't see what is entered in the cell. Is that what you intended?

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch

" wrote:

I need to apply CF macro to my 2003 since I need to have 5
conditions. I know that I can download addins but I am working from a
secure network without internet access.

The range is A1:CM190. Here are my conditions

If the cell value is 1, then the font and internior color index is 6
'yellow'
If the cell value is 2, then the font and internior color index is 46
'Orange'
If the cell value is 3, then the font and internior color index is 37
'blue'
If the cell value is 4, then the font and internior color index is 5
'Dark blue'
If the cell value is 5, then the font and internior color index is 3
'red'

Any help I can get is highly appreciated!!!

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Conditional Formatting Help!

Another one, in the worksheet module -

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, cell As Range
Dim cIdx As Long, fIdx As Long

On Error GoTo errExit
Set rng = Intersect(Range("A1:CM190"), Target)
If Not rng Is Nothing Then
For Each cell In rng
With cell
Select Case .Value
Case 1: cIdx = 6
Case 2: cIdx = 46
Case 3: cIdx = 37
Case 4: cIdx = 5
Case 5: cIdx = 3
Case Else: cIdx = xlNone
End Select

If cIdx = xlNone Then
fIdx = xlAutomatic
Else
fIdx = cIdx
End If

With .Interior
If .ColorIndex < cIdx Then .ColorIndex = cIdx
End With

With .Font
If .ColorIndex < fIdx Then .ColorIndex = fIdx
End With
End With
Next
End If
Exit Sub
errExit:
End Sub

Regards,
Peter T

wrote in message
...
I need to apply CF macro to my 2003 since I need to have 5
conditions. I know that I can download addins but I am working from a
secure network without internet access.

The range is A1:CM190. Here are my conditions

If the cell value is 1, then the font and internior color index is 6
'yellow'
If the cell value is 2, then the font and internior color index is 46
'Orange'
If the cell value is 3, then the font and internior color index is 37
'blue'
If the cell value is 4, then the font and internior color index is 5
'Dark blue'
If the cell value is 5, then the font and internior color index is 3
'red'

Any help I can get is highly appreciated!!!

Thanks!



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
How can I convert conditional formatting into explicit formatting? Patrick Harris Excel Discussion (Misc queries) 0 April 9th 09 12:00 AM
Conditional formatting--different formatting depending on cell con Tammy S. Excel Discussion (Misc queries) 3 March 30th 09 08:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 04:25 PM.

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"