Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Changing row colour if text string present in a cell?

I'm hoping that something like this can be done: if any email address
in a worksheet has a certain text string in it, in this case
", what would the conditional formatting code be that will
then colour that row yellow, if this is indeed possible? The rows go
from 2 to 15, if that info is needed, i.e., A2 to A15, B2 to B15, etc.
(or if necessary, if it's easier to just code the entire row, that
would be acceptable, too, rather than the area of row that is visible
in the sheet).

What this would do is to signal records of people that are inside the
organization vs other govt departments.

Thanks much. Appreciate the help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Changing row colour if text string present in a cell?

Maybe you can use this:

With Range(x)
.FormatConditions.Add Type:=xlCellValue,
Operator:=xlEqual, """
.FormatConditions(1).Interior.Color = vbYellow
End With
But this will only color the given cell

To color the entire row adding this should work (maybe
put it under the Worksheet.Change event):

If Range(x).Interior.Color=vbYellow then
rows(Range(x).Row).Interior.Color=vbYellow
End If


-----Original Message-----
I'm hoping that something like this can be done: if any

email address
in a worksheet has a certain text string in it, in this

case
", what would the conditional formatting code

be that will
then colour that row yellow, if this is indeed

possible? The rows go
from 2 to 15, if that info is needed, i.e., A2 to A15,

B2 to B15, etc.
(or if necessary, if it's easier to just code the entire

row, that
would be acceptable, too, rather than the area of row

that is visible
in the sheet).

What this would do is to signal records of people that

are inside the
organization vs other govt departments.

Thanks much. Appreciate the help.

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Changing row colour if text string present in a cell?


"StargateFan" wrote in message
...
I'm hoping that something like this can be done: if any email address
in a worksheet has a certain text string in it, in this case
", what would the conditional formatting code be that will
then colour that row yellow, if this is indeed possible? The rows go
from 2 to 15, if that info is needed, i.e., A2 to A15, B2 to B15, etc.
(or if necessary, if it's easier to just code the entire row, that
would be acceptable, too, rather than the area of row that is visible
in the sheet).


is there an email in only one column per row? if so then you just have to
select the cells in row 1, go to conditional formating . change the
condition to Formula=, and enter (assuming the email appears in column A)

",$A1)

and set the formating to yellow background

then select the cells, copy. select all the cells below that row and paste
special 'formats'

If the emails appear more than once per row then it's a little more
complicated, so post back in that case.

Iain King


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing row colour if text string present in a cell?

If the color is set with Conditional formatting, then your suggestion of

If Range(x).Interior.Color=vbYellow then
rows(Range(x).Row).Interior.Color=vbYellow
End If


will not work as you can not query a cell for a color being produced by
conditional formatting.



--
Regards,
Tom Ogilvy


wrote in message
...
Maybe you can use this:

With Range(x)
.FormatConditions.Add Type:=xlCellValue,
Operator:=xlEqual, """
.FormatConditions(1).Interior.Color = vbYellow
End With
But this will only color the given cell

To color the entire row adding this should work (maybe
put it under the Worksheet.Change event):

If Range(x).Interior.Color=vbYellow then
rows(Range(x).Row).Interior.Color=vbYellow
End If


-----Original Message-----
I'm hoping that something like this can be done: if any

email address
in a worksheet has a certain text string in it, in this

case
", what would the conditional formatting code

be that will
then colour that row yellow, if this is indeed

possible? The rows go
from 2 to 15, if that info is needed, i.e., A2 to A15,

B2 to B15, etc.
(or if necessary, if it's easier to just code the entire

row, that
would be acceptable, too, rather than the area of row

that is visible
in the sheet).

What this would do is to signal records of people that

are inside the
organization vs other govt departments.

Thanks much. Appreciate the help.

.



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
Text colour keeps changing to grey SarahM Excel Discussion (Misc queries) 0 March 12th 10 12:26 PM
Changing background colour when changing data in a cell Paoul Excel Discussion (Misc queries) 7 December 26th 08 07:25 AM
changing numbers in a text string in a new cell Xhawk57 Excel Discussion (Misc queries) 4 May 16th 07 06:22 PM
Changing the colour of text packfan Excel Discussion (Misc queries) 1 November 27th 06 04:41 AM
Changing colour of text in cell Steve Lowe Excel Programming 5 January 25th 04 07:35 PM


All times are GMT +1. The time now is 06:58 AM.

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"