Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Change Colors With 5 Different Conditions

Greetings,

I am trying to change the color of a row (A:X) when different
conditions are met.

1st condition:
A and B are both empty.
The row from A to X gets InteriorIndex = 19
Border lines get also get ColorIndex = 19
2nd condition:
D ="" and H = "Nancy"
The row from A to X gets InteriorIndex = 6
Border lines get also get ColorIndex = xlAutomatic
3rd condition:
D = "" (H = anything else)
The row from A to X gets InteriorIndex = 39
Border lines get also get ColorIndex = xlAutomatic
4th condition:
D "" and E F (if D is not empty there will always be either
an E or an F)
The row from A to X gets InteriorIndex = 37
Border lines get also get ColorIndex = xlAutomatic
5th condition:
D "" and FE
The row from A to X gets InteriorIndex = 38
Border lines get also get ColorIndex = xlAutomatic

I tried to use the Conditional Formatter, but it only does 3
conditions. Could someone show me how this can be done?

TIA

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Change Colors With 5 Different Conditions

see if this will help

http://www.mrexcel.com/archive/Formatting/12054.html

--


Gary


"Minitman" wrote in message
...
Greetings,

I am trying to change the color of a row (A:X) when different
conditions are met.

1st condition:
A and B are both empty.
The row from A to X gets InteriorIndex = 19
Border lines get also get ColorIndex = 19
2nd condition:
D ="" and H = "Nancy"
The row from A to X gets InteriorIndex = 6
Border lines get also get ColorIndex = xlAutomatic
3rd condition:
D = "" (H = anything else)
The row from A to X gets InteriorIndex = 39
Border lines get also get ColorIndex = xlAutomatic
4th condition:
D "" and E F (if D is not empty there will always be either
an E or an F)
The row from A to X gets InteriorIndex = 37
Border lines get also get ColorIndex = xlAutomatic
5th condition:
D "" and FE
The row from A to X gets InteriorIndex = 38
Border lines get also get ColorIndex = xlAutomatic

I tried to use the Conditional Formatter, but it only does 3
conditions. Could someone show me how this can be done?

TIA

-Minitman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Change Colors With 5 Different Conditions

I have written a number of replies in this NG will code on setting mulitple
colors for 3 conditions

"Minitman" wrote:

Greetings,

I am trying to change the color of a row (A:X) when different
conditions are met.

1st condition:
A and B are both empty.
The row from A to X gets InteriorIndex = 19
Border lines get also get ColorIndex = 19
2nd condition:
D ="" and H = "Nancy"
The row from A to X gets InteriorIndex = 6
Border lines get also get ColorIndex = xlAutomatic
3rd condition:
D = "" (H = anything else)
The row from A to X gets InteriorIndex = 39
Border lines get also get ColorIndex = xlAutomatic
4th condition:
D "" and E F (if D is not empty there will always be either
an E or an F)
The row from A to X gets InteriorIndex = 37
Border lines get also get ColorIndex = xlAutomatic
5th condition:
D "" and FE
The row from A to X gets InteriorIndex = 38
Border lines get also get ColorIndex = xlAutomatic

I tried to use the Conditional Formatter, but it only does 3
conditions. Could someone show me how this can be done?

TIA

-Minitman

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Change Colors With 5 Different Conditions

One of many examples at http://tinyurl.com/b7kly

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Minitman" wrote in message
...
Greetings,

I am trying to change the color of a row (A:X) when different
conditions are met.

1st condition:
A and B are both empty.
The row from A to X gets InteriorIndex = 19
Border lines get also get ColorIndex = 19
2nd condition:
D ="" and H = "Nancy"
The row from A to X gets InteriorIndex = 6
Border lines get also get ColorIndex = xlAutomatic
3rd condition:
D = "" (H = anything else)
The row from A to X gets InteriorIndex = 39
Border lines get also get ColorIndex = xlAutomatic
4th condition:
D "" and E F (if D is not empty there will always be either
an E or an F)
The row from A to X gets InteriorIndex = 37
Border lines get also get ColorIndex = xlAutomatic
5th condition:
D "" and FE
The row from A to X gets InteriorIndex = 38
Border lines get also get ColorIndex = xlAutomatic

I tried to use the Conditional Formatter, but it only does 3
conditions. Could someone show me how this can be done?

TIA

-Minitman



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Change Colors With 5 Different Conditions

Hey Bob,

Thanks for the reply.

I am not sure how to enter the target (A2:X250 on each of 120 sheets).
Or how to reference the Case's. I am only using Columns A, B, D & H.
I am trying to color the entire row within the target range. I am
really at a loss as to how to make this. I have been paging through
the archives and am left with the questions at the start of this
reply.

Any help would be most appreciated.

TIA

-Minitman


On Mon, 25 Jul 2005 09:51:31 +0100, "Bob Phillips"
wrote:

One of many examples at http://tinyurl.com/b7kly

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Minitman" wrote in message
.. .
Greetings,

I am trying to change the color of a row (A:X) when different
conditions are met.

1st condition:
A and B are both empty.
The row from A to X gets InteriorIndex = 19
Border lines get also get ColorIndex = 19
2nd condition:
D ="" and H = "Nancy"
The row from A to X gets InteriorIndex = 6
Border lines get also get ColorIndex = xlAutomatic
3rd condition:
D = "" (H = anything else)
The row from A to X gets InteriorIndex = 39
Border lines get also get ColorIndex = xlAutomatic
4th condition:
D "" and E F (if D is not empty there will always be either
an E or an F)
The row from A to X gets InteriorIndex = 37
Border lines get also get ColorIndex = xlAutomatic
5th condition:
D "" and FE
The row from A to X gets InteriorIndex = 38
Border lines get also get ColorIndex = xlAutomatic

I tried to use the Conditional Formatter, but it only does 3
conditions. Could someone show me how this can be done?

TIA

-Minitman





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Change Colors With 5 Different Conditions

This should get you started. It works for every sheet in the workbook

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Sh.Range("A2:X250")) Is Nothing Then
With Target
Select Case .Value
Case 1: .EntireRow.Interior.ColorIndex = 1
Case 2: .EntireRow.Interior.ColorIndex = 2
Case 3: .EntireRow.Interior.ColorIndex = 3
Case 4: .EntireRow.Interior.ColorIndex = 4
Case 5: .EntireRow.Interior.ColorIndex = 5
Case 6: .EntireRow.Interior.ColorIndex = 6
End Select

End With
End If

ws_exit:
Application.EnableEvents = True

End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Minitman" wrote in message
...
Hey Bob,

Thanks for the reply.

I am not sure how to enter the target (A2:X250 on each of 120 sheets).
Or how to reference the Case's. I am only using Columns A, B, D & H.
I am trying to color the entire row within the target range. I am
really at a loss as to how to make this. I have been paging through
the archives and am left with the questions at the start of this
reply.

Any help would be most appreciated.

TIA

-Minitman


On Mon, 25 Jul 2005 09:51:31 +0100, "Bob Phillips"
wrote:

One of many examples at http://tinyurl.com/b7kly

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Minitman" wrote in message
.. .
Greetings,

I am trying to change the color of a row (A:X) when different
conditions are met.

1st condition:
A and B are both empty.
The row from A to X gets InteriorIndex = 19
Border lines get also get ColorIndex = 19
2nd condition:
D ="" and H = "Nancy"
The row from A to X gets InteriorIndex = 6
Border lines get also get ColorIndex = xlAutomatic
3rd condition:
D = "" (H = anything else)
The row from A to X gets InteriorIndex = 39
Border lines get also get ColorIndex = xlAutomatic
4th condition:
D "" and E F (if D is not empty there will always be either
an E or an F)
The row from A to X gets InteriorIndex = 37
Border lines get also get ColorIndex = xlAutomatic
5th condition:
D "" and FE
The row from A to X gets InteriorIndex = 38
Border lines get also get ColorIndex = xlAutomatic

I tried to use the Conditional Formatter, but it only does 3
conditions. Could someone show me how this can be done?

TIA

-Minitman





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Change Colors With 5 Different Conditions

Hey Bob,

Thanks for the sample.

A couple of questions do present them selves.

How are the conditions assigned to the Case's?
And how do I limit the row to only A thru X?

-Minitman


On Mon, 25 Jul 2005 10:38:23 +0100, "Bob Phillips"
wrote:

This should get you started. It works for every sheet in the workbook

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Sh.Range("A2:X250")) Is Nothing Then
With Target
Select Case .Value
Case 1: .EntireRow.Interior.ColorIndex = 1
Case 2: .EntireRow.Interior.ColorIndex = 2
Case 3: .EntireRow.Interior.ColorIndex = 3
Case 4: .EntireRow.Interior.ColorIndex = 4
Case 5: .EntireRow.Interior.ColorIndex = 5
Case 6: .EntireRow.Interior.ColorIndex = 6
End Select

End With
End If

ws_exit:
Application.EnableEvents = True

End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Change Colors With 5 Different Conditions


"Minitman" wrote in message
...
Hey Bob,

Thanks for the sample.

A couple of questions do present them selves.

How are the conditions assigned to the Case's?


I have used numbers, Case 1 etc. You can change to text Case "abc" etc.

And how do I limit the row to only A thru X?


It already is, by the intersect.


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
Change tab colors via programming Bob New Users to Excel 1 January 5th 09 10:23 PM
Excel bar chart formatting of bars to change colors as data change JudyT Excel Discussion (Misc queries) 1 January 24th 07 06:07 PM
change colors L. Setting up and Configuration of Excel 2 November 28th 05 09:07 PM
macro used to change colors Brian in FT W. Excel Worksheet Functions 12 June 7th 05 06:30 PM
How do I use VBA to change line colors Dilbert00 Charts and Charting in Excel 2 June 4th 05 01:37 PM


All times are GMT +1. The time now is 12:20 PM.

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"