ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Changing color of a row (https://www.excelbanter.com/excel-discussion-misc-queries/151032-changing-color-row.html)

David G[_2_]

Changing color of a row
 
Is there any way to change the color of the row based on the value of PM in
the cell and then check the rest of the spreadsheet for the PM value and
change the color of the rest of the row? See example below.

Project Amount PM Color desired
123 125000 DG red
234 26715 CG blue
345 1243 EG green
456 258000 CG blue
567 12589 CG blue
678 77500 DG red
789 65875 EG green


bj

Changing color of a row
 
for three colors you can use conditonal formatting
select all
format-conditional format
criteria 1
formula is =or($A1=123,$A1=678)
set fomat red
criteria 2
formula is =or($A1=234,$A1=456,$A1=567)
set fomat blue
etc

unfortunately before 2007 only three conditonal formats can be used.
"David G" wrote:

Is there any way to change the color of the row based on the value of PM in
the cell and then check the rest of the spreadsheet for the PM value and
change the color of the rest of the row? See example below.

Project Amount PM Color desired
123 125000 DG red
234 26715 CG blue
345 1243 EG green
456 258000 CG blue
567 12589 CG blue
678 77500 DG red
789 65875 EG green


David G[_2_]

Changing color of a row
 
Is there a way in VB that a for next loop could be setup to check the whole
spreadsheet and change the color based on the value of the PM?

"bj" wrote:

for three colors you can use conditonal formatting
select all
format-conditional format
criteria 1
formula is =or($A1=123,$A1=678)
set fomat red
criteria 2
formula is =or($A1=234,$A1=456,$A1=567)
set fomat blue
etc

unfortunately before 2007 only three conditonal formats can be used.
"David G" wrote:

Is there any way to change the color of the row based on the value of PM in
the cell and then check the rest of the spreadsheet for the PM value and
change the color of the rest of the row? See example below.

Project Amount PM Color desired
123 125000 DG red
234 26715 CG blue
345 1243 EG green
456 258000 CG blue
567 12589 CG blue
678 77500 DG red
789 65875 EG green


bj

Changing color of a row
 
Actually looking at It I was going against the wrong column.
in a macro you could have something like

for r = 1 to 1000
if cells(r,3)="DG" then
cells(r.3).entirerow.select
With Selection.Interior
.ColorIndex = 3 ' red
.Pattern = xlSolid
End With
end if
if cells(r,3)="DG" then
cells(r.3).entirerow.select
With Selection.Interior
.ColorIndex = 5 ' Blue
.Pattern = xlSolid
End With

etc

next r
end if

ac

"David G" wrote:

Is there a way in VB that a for next loop could be setup to check the whole
spreadsheet and change the color based on the value of the PM?

"bj" wrote:

for three colors you can use conditonal formatting
select all
format-conditional format
criteria 1
formula is =or($A1=123,$A1=678)
set fomat red
criteria 2
formula is =or($A1=234,$A1=456,$A1=567)
set fomat blue
etc

unfortunately before 2007 only three conditonal formats can be used.
"David G" wrote:

Is there any way to change the color of the row based on the value of PM in
the cell and then check the rest of the spreadsheet for the PM value and
change the color of the rest of the row? See example below.

Project Amount PM Color desired
123 125000 DG red
234 26715 CG blue
345 1243 EG green
456 258000 CG blue
567 12589 CG blue
678 77500 DG red
789 65875 EG green



All times are GMT +1. The time now is 09:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com