Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jim jim is offline
external usenet poster
 
Posts: 2
Default highlight cell text

I have an excel spreadsheet that I have to update every month. This
involves laboriously highlighting all text between the characters "<"
and "" in one particular column. Is it possible to write a macro
that will make my life easier?! I'm new to this so all pointers would
be really appreciated.

MTIA

Jim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default highlight cell text

Jim,

Here is one way using conditional formatting.

Select all the cells in the column (I am assuming column A).
Goto to FormatConditional Formatting
Set Condition 1 to Formula Is
Add this formula
=AND(ROW(A1)<=MATCH("",$A$1:$A$100,0),ROW(A1)=MA TCH("<",$A$1:$A$100,0))
Click format, and set a pattern colour
OK out

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"jim" wrote in message
m...
I have an excel spreadsheet that I have to update every month. This
involves laboriously highlighting all text between the characters "<"
and "" in one particular column. Is it possible to write a macro
that will make my life easier?! I'm new to this so all pointers would
be really appreciated.

MTIA

Jim



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default highlight cell text

Dim ColToCheck as range
Dim cl as range,Temp as string

set ColToCheck=range(cells(1,1),cells(1,1).end(xldown) )

for each cl in ColToCheck



-----Original Message-----
I have an excel spreadsheet that I have to update every

month. This
involves laboriously highlighting all text between the

characters "<"
and "" in one particular column. Is it possible to

write a macro
that will make my life easier?! I'm new to this so all

pointers would
be really appreciated.

MTIA

Jim
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default highlight cell text

do you mean some cells contain a text string like

the object of her desire < Brian Crumply was new to the club.

Assuming yes,

You would want Brian Crumply highighted with color? bolding? Italics?
different Font/Size?

Could there be multiple < pairs in a single cell.

--
Regards,
Tom Ogilvy


"jim" wrote in message
m...
I have an excel spreadsheet that I have to update every month. This
involves laboriously highlighting all text between the characters "<"
and "" in one particular column. Is it possible to write a macro
that will make my life easier?! I'm new to this so all pointers would
be really appreciated.

MTIA

Jim



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default highlight cell text

Hi Bob

I thought that would solve my problem but unfortunately it didn't work.
Just to clarify I have cells with various text in e.g. the car whent
through <span class="five"the mud </span. I need to be able to
highlight the html parts of the string.

Many thanks

jim



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


  #6   Report Post  
Posted to microsoft.public.excel.programming
jim jim is offline
external usenet poster
 
Posts: 2
Default highlight cell text

Hi Bob

I thought that would solve my problem but unfortunately it didn't work.
Just to clarify I have cells with various text in e.g. the car went
through <span class="five"the mud </span. I need to be able to
highlight the html parts of the string.

Many thanks

jim


"Bob Phillips" wrote in message ...
Jim,

Here is one way using conditional formatting.

Select all the cells in the column (I am assuming column A).
Goto to FormatConditional Formatting
Set Condition 1 to Formula Is
Add this formula
=AND(ROW(A1)<=MATCH("",$A$1:$A$100,0),ROW(A1)=MA TCH("<",$A$1:$A$100,0))
Click format, and set a pattern colour
OK out

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"jim" wrote in message
m...
I have an excel spreadsheet that I have to update every month. This
involves laboriously highlighting all text between the characters "<"
and "" in one particular column. Is it possible to write a macro
that will make my life easier?! I'm new to this so all pointers would
be really appreciated.

MTIA

Jim

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default highlight cell text

Sorry, I read it that the < was in a cell marking a start point, in
another marking the end point.

Here's some VBA that should do it. Select all the cells, then run this macro

Sub HighlightText()
Dim cell As Range
Dim i As Long
Dim iStart As Long
Dim iEnd As Long

For Each cell In Selection
i = 1
Do
iStart = InStr(i, cell.Value, "<")
If iStart 0 Then
iEnd = InStr(iStart + 1, cell.Value, "")
If iEnd < 1 Then
iEnd = Len(cell.Value) + 1
End If
With cell.Characters(iStart + 1, iEnd - 1 - iStart).Font
.Bold = True
.ColorIndex = 3
End With
End If
i = iEnd + 1
Loop Until iStart < 1
Next cell
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"jim briers" wrote in message
...
Hi Bob

I thought that would solve my problem but unfortunately it didn't work.
Just to clarify I have cells with various text in e.g. the car whent
through <span class="five"the mud </span. I need to be able to
highlight the html parts of the string.

Many thanks

jim



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default highlight cell text

Works like a dream Bob!

Thanks very much

Jim



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default highlight cell text

Pleasure. Took a while to sink in, but I got it I the end.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"jim briers" wrote in message
...
Works like a dream Bob!

Thanks very much

Jim



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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 to highlight more related cells if cell highlight Jon Excel Discussion (Misc queries) 5 December 21st 08 01:06 PM
How can I highlight only some of the text within a cell in Excel? JVA Excel Discussion (Misc queries) 2 August 12th 08 09:02 PM
highlight cell contain the value and text with formula ratheesh Excel Discussion (Misc queries) 2 March 11th 08 06:48 AM
How do I highlight text only within a cell in Xcel? GRC Excel Discussion (Misc queries) 1 January 3rd 08 05:56 PM
Highlight cells with ctrl-click but only un-highlight one cell hagan Excel Discussion (Misc queries) 5 May 27th 05 06:45 PM


All times are GMT +1. The time now is 06:28 PM.

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"