Conditional Formatting

Dan in Lowell

New Member
Joined
Sep 29, 2006
Messages
14
Hi,

I have a spreadshhet in which activities are listed one per row and there are data elements in columns a through r for each item. In column G is a status indicator which is selected from a drop down menue so as to ensure the consitancey of the status spelling etc.

I would like to apply conditional formatting that will color each row a different color depending on the status indicator. (e.g: Pending status = blue, Completed = yellow, etc.) I would like the formatting to not go beyond the R column so that the remaining empty column beyond column r are never considered in the print range by virtue of having been formatted.

Thanks in advance for your help.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
How many formats do you want to apply?

If it's only 3 then you can easily do this using a formula in conditional formatting.

Just select the required rows in columns A-R, goto Format>Conditional Formatting..., select formula is, enter this formula

=$G1="Status"

and format as required.

Hit Add and repeat for the other conditions.

Note change 1 if the data starts in row 2, or whatever.
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Hi Dan. Supposing you have more than 3 formats, you will need code. Since your status column is G, we will work off of that. Here's how it would work. The code would look something like this
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column <> 7 Then Exit Sub
Dim myColor As Variant
Select Case Target
Case "Case 1": myColor = 5
Case "Case 2": myColor = 6
Case "Case 3": myColor = 7
'etc
Case Else: myColor = xlNone
End Select
Target.Offset(0, -6).Resize(1, 18).Interior.ColorIndex = myColor
End Sub

HTH

lenze
 

Forum statistics

Threads
1,136,307
Messages
5,674,986
Members
419,541
Latest member
freddyboots

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top