ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting Rows based on word being found in cell (https://www.excelbanter.com/excel-programming/378432-formatting-rows-based-word-being-found-cell.html)

[email protected]

Formatting Rows based on word being found in cell
 
I have multiple static words which I want to have a macro search for
within the first two columns of the sheet.

If the words are found then the rows are to be formatted in bold.

I tried to record a macro for this but was hopeless.

Can someone help?

There are around 5 words in totals that I would like the macro to
search for.

Thank you

Andrea


Ken

Formatting Rows based on word being found in cell
 
Andrea

If the words you are looking for constitute the entire contents of the
cells in columns A or B, you can accomplish this easily with
conditional formatting.

The condition would be something like:

Condition 1
Formula is =or($a1="one", $a1="two", $b1="one",$b1="two")

but including all 10 possibilites in the OR statement, assuming each of
the 5 words could be in either column A or B. If some words can be in
only one of the columns you would of course have fewer possibilites in
your OR statement.

If the words can be embedded in longer strings in those columns, you
have a more difficult, but not insurmountable, situation.

Good luck.

Ken
Norfolk, Va




wrote:
I have multiple static words which I want to have a macro search for
within the first two columns of the sheet.

If the words are found then the rows are to be formatted in bold.

I tried to record a macro for this but was hopeless.

Can someone help?

There are around 5 words in totals that I would like the macro to
search for.

Thank you

Andrea



Don Guillett

Formatting Rows based on word being found in cell
 
You say first two columns. Do you mean word in EITHER column of the row or?

--
Don Guillett
SalesAid Software

wrote in message
oups.com...
I have multiple static words which I want to have a macro search for
within the first two columns of the sheet.

If the words are found then the rows are to be formatted in bold.

I tried to record a macro for this but was hopeless.

Can someone help?

There are around 5 words in totals that I would like the macro to
search for.

Thank you

Andrea




Don Guillett

Formatting Rows based on word being found in cell
 
Or, (NO pun intended)

=OR(a1={"a","b"})
=OR(C1={"a","b"},C2={"x","y"})
--
Don Guillett
SalesAid Software

"Charles Chickering" wrote in
message ...
While a macro would certainly get the job done it is not required here. A
simple (or maybe not-so-simple) conditional format will do the job nicely.
To
apply this, select the desired rows, then click "Format", then
"Conditional
Formatting...". Change the "Cell Value Is" dropdown to say "Formula Is",
then
copy this formula into the formula area:
=OR($A1="Hi",$A1="bye",$A1="Test",$A1="Help",$A1=" ah",$B1="Hi",$B1="bye",$B1="Test",$B1="Help",$B1=" ah")=TRUE

Change all the 1's in "$A1" and "$B1" to the currently selected row, and
change the text strings to your search text. Next click the "Format"
button
and click the "Bold" option box. that should pretty well take care of it
for
you. post back if you need help.
--
Charles Chickering

"A good example is twice the value of good advice."


" wrote:

I have multiple static words which I want to have a macro search for
within the first two columns of the sheet.

If the words are found then the rows are to be formatted in bold.

I tried to record a macro for this but was hopeless.

Can someone help?

There are around 5 words in totals that I would like the macro to
search for.

Thank you

Andrea






All times are GMT +1. The time now is 11:35 PM.

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