PC Review


Reply
Thread Tools Rate Thread

Conditional Formatting a whole line based on cell value

 
 
Maver1ck666
Guest
Posts: n/a
 
      20th Feb 2008
Okay, I have a spreadsheet with over 1000 lines of data in all at different
status' of progress.

What I would like to do it to highlight the whole line a certain colour
depending on the status value.

I currently have the max 3 conditional formats doing this but I need to
expand them and there are over 10 different status'.

My spreadsheet runs from A to L (with the status being I). Is there any way
the formatting could loop to check the whole spreadsheet?

Thanks in advanced for your help.

Maver1ck666
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      20th Feb 2008
Best to do that with event code, trigger the code when the target column
changes

As an example


'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "H:H" '<=== change to suit

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Select Case .Value
Case 1: .Entirerow.Interior.ColorIndex = 3 'red
Case 2: .Entirerow.Interior.ColorIndex = 6 'yellow
Case 3: .Entirerow.Interior.ColorIndex = 5 'blue
Case 4: .Entirerow.Interior.ColorIndex = 10 'green
End Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Maver1ck666" <(E-Mail Removed)> wrote in message
news:E8F12960-DB17-4A8B-92CF-(E-Mail Removed)...
> Okay, I have a spreadsheet with over 1000 lines of data in all at
> different
> status' of progress.
>
> What I would like to do it to highlight the whole line a certain colour
> depending on the status value.
>
> I currently have the max 3 conditional formats doing this but I need to
> expand them and there are over 10 different status'.
>
> My spreadsheet runs from A to L (with the status being I). Is there any
> way
> the formatting could loop to check the whole spreadsheet?
>
> Thanks in advanced for your help.
>
> Maver1ck666



 
Reply With Quote
 
Maver1ck666
Guest
Posts: n/a
 
      21st Feb 2008
Cheers for the reply.

would I not have to do this though to each column?

"Bob Phillips" wrote:

> Best to do that with event code, trigger the code when the target column
> changes
>
> As an example
>
>
> '-----------------------------------------------------------------
> Private Sub Worksheet_Change(ByVal Target As Range)
> '-----------------------------------------------------------------
> Const WS_RANGE As String = "H:H" '<=== change to suit
>
> On Error GoTo ws_exit:
> Application.EnableEvents = False
> If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
> With Target
> Select Case .Value
> Case 1: .Entirerow.Interior.ColorIndex = 3 'red
> Case 2: .Entirerow.Interior.ColorIndex = 6 'yellow
> Case 3: .Entirerow.Interior.ColorIndex = 5 'blue
> Case 4: .Entirerow.Interior.ColorIndex = 10 'green
> End Select
> End With
> End If
>
> ws_exit:
> Application.EnableEvents = True
> End Sub
>
> 'This is worksheet event code, which means that it needs to be
> 'placed in the appropriate worksheet code module, not a standard
> 'code module. To do this, right-click on the sheet tab, select
> 'the View Code option from the menu, and paste the code in.
>
>
> --
> ---
> HTH
>
> Bob
>
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
>
>
> "Maver1ck666" <(E-Mail Removed)> wrote in message
> news:E8F12960-DB17-4A8B-92CF-(E-Mail Removed)...
> > Okay, I have a spreadsheet with over 1000 lines of data in all at
> > different
> > status' of progress.
> >
> > What I would like to do it to highlight the whole line a certain colour
> > depending on the status value.
> >
> > I currently have the max 3 conditional formats doing this but I need to
> > expand them and there are over 10 different status'.
> >
> > My spreadsheet runs from A to L (with the status being I). Is there any
> > way
> > the formatting could loop to check the whole spreadsheet?
> >
> > Thanks in advanced for your help.
> >
> > Maver1ck666

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting of one cell based on another using vba Dee Microsoft Excel Programming 2 5th Oct 2008 05:19 PM
Conditional formatting Based on cell A text with conditions in Cell B Raicomm Microsoft Excel Misc 0 21st Jan 2008 04:46 PM
conditional Formatting based on cell formatting Totom Microsoft Excel Worksheet Functions 1 20th Jan 2007 02:02 PM
conditional Formatting based on cell formatting Totom Microsoft Excel Worksheet Functions 0 15th Jan 2007 04:35 PM
Conditional cell background formatting, based on cell content nosivad Microsoft Excel Misc 5 11th Feb 2006 11:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:55 PM.