PC Review


Reply
Thread Tools Rate Thread

Condtional Formatting or VBA Code

 
 
RyanH
Guest
Posts: n/a
 
      10th Sep 2008
I want to conditionally format an entire column. Each cell in the column may
equal "Ready", "Archive", "Late-1", "Late-2", "Late-3", and so on. I want
all the cells that contain "Late" in them to have an interior colorindex = 3.
I think I need to return the first 4 letters of the cell in this condition.
How do I do that?

This does not work, because I do not know how to represent Cell.Value in
this formula below:
Cell Value Is - Equal To - =LEFT(Cell.Value, 4)="Late"

I would consider VBA code if it is really fast, the column may contain about
400 cells to scan down. I have this, but I would like a faster way to code
it.

For i = 3 To Cells(Rows.Count, "A").End(xlUp).Row
If Left(Cells(i, "L", 4)) = "Late" Then
Cells(i, "L").Interior.ColorIndex = 3
End If
Next i

--
Cheers,
Ryan
 
Reply With Quote
 
 
 
 
sbitaxi@gmail.com
Guest
Posts: n/a
 
      10th Sep 2008
On Sep 10, 3:31*pm, RyanH <Ry...@discussions.microsoft.com> wrote:
> I want to conditionally format an entire column. *Each cell in the column may
> equal "Ready", "Archive", "Late-1", "Late-2", "Late-3", and so on. *I want
> all the cells that contain "Late" in them to have an interior colorindex = 3.
> *I think I need to return the first 4 letters of the cell in this condition. *
> How do I do that?
>
> This does not work, because I do not know how to represent Cell.Value in
> this formula below:
> Cell Value Is - Equal To - =LEFT(Cell.Value, 4)="Late"
>
> I would consider VBA code if it is really fast, the column may contain about
> 400 cells to scan down. *I have this, but I would like a faster way to code
> it.
>
> * * For i = 3 To Cells(Rows.Count, "A").End(xlUp).Row
> * * * * If Left(Cells(i, "L", 4)) = "Late" Then
> * * * * * * Cells(i, "L").Interior.ColorIndex = 3
> * * * * End If
> * * Next i
>
> --
> Cheers,
> Ryan


Use conditional formatting -

Select column L
Format>Conditional Formatting
Formula is =LEFT(L1,4)="Late"
Pattern = select the colour of your choice

That will do it for you.


S


That should do it for you.
 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      10th Sep 2008
maybe this can get you started:

Sub test()
Range("L1").Select
With Columns("L")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=upper(LEFT($L1,4))=""LATE"""
.FormatConditions(1).Interior.ColorIndex = 3
End With
End Sub


--


Gary


"RyanH" <(E-Mail Removed)> wrote in message
news:BD9CF0B2-4123-4E90-9682-(E-Mail Removed)...
>I want to conditionally format an entire column. Each cell in the column may
> equal "Ready", "Archive", "Late-1", "Late-2", "Late-3", and so on. I want
> all the cells that contain "Late" in them to have an interior colorindex = 3.
> I think I need to return the first 4 letters of the cell in this condition.
> How do I do that?
>
> This does not work, because I do not know how to represent Cell.Value in
> this formula below:
> Cell Value Is - Equal To - =LEFT(Cell.Value, 4)="Late"
>
> I would consider VBA code if it is really fast, the column may contain about
> 400 cells to scan down. I have this, but I would like a faster way to code
> it.
>
> For i = 3 To Cells(Rows.Count, "A").End(xlUp).Row
> If Left(Cells(i, "L", 4)) = "Late" Then
> Cells(i, "L").Interior.ColorIndex = 3
> End If
> Next i
>
> --
> Cheers,
> Ryan



 
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
Condtional Formatting Sam Harman Microsoft Excel Discussion 2 22nd Jul 2011 01:53 PM
Condtional Formatting bollard Microsoft Excel Worksheet Functions 2 24th Apr 2008 03:16 PM
Condtional Formatting PAL Microsoft Excel Worksheet Functions 11 3rd Jan 2008 07:34 PM
Condtional formatting in VBA help! Simon Lloyd Microsoft Excel Programming 0 9th May 2004 10:30 AM
condtional formatting adn4n Microsoft Excel Misc 2 20th Apr 2004 12:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:30 AM.