Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Conditional Formatting

I am using Excel 97 and want to colour a cell if it
includes the word say for example 'business' somewhere in
the text of that cell.

Checking each cell in a column of lets say a 1000 entries

Can anyone assist me with some code if this is possible
please?


Thanks

Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Conditional Formatting

The follwoing code looks in a sheets range
called 'MyRange' ...

Sub ColorTest()

Dim Trgt As Range
Dim firstadd As String
Set Trgt = ThisWorkbook.Names
("MyRange").RefersToRange.Find("business")


If Not Trgt Is Nothing Then
firstadd = Trgt.Address
Do
Trgt.Interior.ColorIndex = 34
Set Trgt = ThisWorkbook.Names
("MyRange").RefersToRange.FindNext(Trgt)
Loop Until Trgt.Address = firstadd
End If


End Sub

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
I am using Excel 97 and want to colour a cell if it
includes the word say for example 'business' somewhere

in
the text of that cell.

Checking each cell in a column of lets say a 1000 entries

Can anyone assist me with some code if this is possible
please?


Thanks

Mark
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Conditional Formatting

No real need for cod
Select the range and g
FormatConditional Formattin
Change the left dropdown to "Formula Is" andenter
=FIND("BUSINESS",UPPER(A1)
where the 1st cell in the range is A1
  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Conditional Formatting


Patrick,

For some reason when I run this code I get the following
error at this point

Set Trgt = ThisWorkbook.Names
("MyRange").RefersToRange.Find("business")

Run-time 1004
Application-defined or object-defined error

Any ideas?

Mark


-----Original Message-----
The follwoing code looks in a sheets range
called 'MyRange' ...

Sub ColorTest()

Dim Trgt As Range
Dim firstadd As String
Set Trgt = ThisWorkbook.Names
("MyRange").RefersToRange.Find("business")


If Not Trgt Is Nothing Then
firstadd = Trgt.Address
Do
Trgt.Interior.ColorIndex = 34
Set Trgt = ThisWorkbook.Names
("MyRange").RefersToRange.FindNext(Trgt)
Loop Until Trgt.Address = firstadd
End If


End Sub

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
I am using Excel 97 and want to colour a cell if it
includes the word say for example 'business' somewhere

in
the text of that cell.

Checking each cell in a column of lets say a 1000 entries

Can anyone assist me with some code if this is possible
please?


Thanks

Mark
.

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Conditional Formatting

Patrick,

Are you sure you have a range named "MyRange"? Does the following
work?

Set Trgt = Range("MyRange").Find("business")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

wrote in message
...

Patrick,

For some reason when I run this code I get the following
error at this point

Set Trgt = ThisWorkbook.Names
("MyRange").RefersToRange.Find("business")

Run-time 1004
Application-defined or object-defined error

Any ideas?

Mark


-----Original Message-----
The follwoing code looks in a sheets range
called 'MyRange' ...

Sub ColorTest()

Dim Trgt As Range
Dim firstadd As String
Set Trgt = ThisWorkbook.Names
("MyRange").RefersToRange.Find("business")


If Not Trgt Is Nothing Then
firstadd = Trgt.Address
Do
Trgt.Interior.ColorIndex = 34
Set Trgt = ThisWorkbook.Names
("MyRange").RefersToRange.FindNext(Trgt)
Loop Until Trgt.Address = firstadd
End If


End Sub

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
I am using Excel 97 and want to colour a cell if it
includes the word say for example 'business' somewhere

in
the text of that cell.

Checking each cell in a column of lets say a 1000 entries

Can anyone assist me with some code if this is possible
please?


Thanks

Mark
.

.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Conditional Formatting

does XL97 have conditional formatting?

-----Original Message-----
No real need for code
Select the range and go
FormatConditional Formatting
Change the left dropdown to "Formula Is" andenter:
=FIND("BUSINESS",UPPER(A1))
where the 1st cell in the range is A1
.

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
How can I convert conditional formatting into explicit formatting? Patrick Harris Excel Discussion (Misc queries) 0 April 9th 09 12:00 AM
Conditional formatting--different formatting depending on cell con Tammy S. Excel Discussion (Misc queries) 3 March 30th 09 08:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"