Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Goo
 
Posts: n/a
Default How do I conditionally format only some of the text in a cell?

For example any time a cell contains the text "greater" I would like the font
for the word greater to be bold but not the other text in that cell.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron de Bruin
 
Posts: n/a
Default How do I conditionally format only some of the text in a cell?

Hi Goo

Only possible with code not with Conditional Formatting.
Do you want to use code ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Goo" wrote in message ...
For example any time a cell contains the text "greater" I would like the font
for the word greater to be bold but not the other text in that cell.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default How do I conditionally format only some of the text in a cell?

Not possible using conditional formatting

Regards,

Peo Sjoblom

"Goo" wrote:

For example any time a cell contains the text "greater" I would like the font
for the word greater to be bold but not the other text in that cell.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary
 
Posts: n/a
Default How do I conditionally format only some of the text in a cell?

Go to Format / conditional formatting

in the first box, select CELL VALUE IS from the drop down.

in the second box, select EQUAL TO from the drop down.

in the third box write, GREATER (or whatever the word is)

click on Format and format the font.

I hope it helps.

GARY
"Goo" wrote in message
...
For example any time a cell contains the text "greater" I would like the
font
for the word greater to be bold but not the other text in that cell.



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett
 
Posts: n/a
Default How do I conditionally format only some of the text in a cell?

this is the idea. modify to suit needs. Perhaps a worksheet_change event?

Sub boldwordinstring()
pos = InStr(ActiveCell, "greater")
With ActiveCell.Characters(Start:=pos, Length:=7).Font
.FontStyle = "Regular"
If pos 0 Then
' .Name = "Courier"
.FontStyle = "Bold"
' .Size = 10
' .Underline = xlUnderlineStyleNone
' .ColorIndex = xlAutomatic
End If
End With
End Sub


--
Don Guillett
SalesAid Software

"Goo" wrote in message
...
For example any time a cell contains the text "greater" I would like the
font
for the word greater to be bold but not the other text in that cell.





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default How do I conditionally format only some of the text in a cell?

My formula in excel contains the following formula. I am only wanting to
conditionally format the word incresed in a color. Can you tell me how to go
about doing this? Regards.

=" increased from " & TEXT(AsthmaER Previous,"0.0") & " in " & DMPrevYE &"."

"Don Guillett" wrote:

this is the idea. modify to suit needs. Perhaps a worksheet_change event?

Sub boldwordinstring()
pos = InStr(ActiveCell, "greater")
With ActiveCell.Characters(Start:=pos, Length:=7).Font
.FontStyle = "Regular"
If pos 0 Then
' .Name = "Courier"
.FontStyle = "Bold"
' .Size = 10
' .Underline = xlUnderlineStyleNone
' .ColorIndex = xlAutomatic
End If
End With
End Sub


--
Don Guillett
SalesAid Software

"Goo" wrote in message
...
For example any time a cell contains the text "greater" I would like the
font
for the word greater to be bold but not the other text in that cell.




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default How do I conditionally format only some of the text in a cell?

Hi Don,

I know this post is really old but, I was wondering if you could tell me how
to modify your code below to not only change the first instance of "greater"
but, EACH instance?

Thank you for your help!
Miklo

"Don Guillett" wrote:

this is the idea. modify to suit needs. Perhaps a worksheet_change event?

Sub boldwordinstring()
pos = InStr(ActiveCell, "greater")
With ActiveCell.Characters(Start:=pos, Length:=7).Font
.FontStyle = "Regular"
If pos 0 Then
' .Name = "Courier"
.FontStyle = "Bold"
' .Size = 10
' .Underline = xlUnderlineStyleNone
' .ColorIndex = xlAutomatic
End If
End With
End Sub


--
Don Guillett
SalesAid Software

"Goo" wrote in message
...
For example any time a cell contains the text "greater" I would like the
font
for the word greater to be bold but not the other text in that cell.




  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 457
Default How do I conditionally format only some of the text in a cell?

'Loops through the macro until pos = 0

Sub boldwordinstring()
MyWord = ActiveCell.Value
Do
pos = InStr(MyWord, "greater")
'Keep track of where you are in the word
x = pos + x
With ActiveCell.Characters(Start:=x, Length:=7).Font
If pos 0 Then
.FontStyle = "Bold"
End If
End With

MyWord = Mid(MyWord, pos + 1, 9999)
Loop Until pos = 0
End Sub

--
Best Regards,

Luke M
"Miklo" wrote in message
...
Hi Don,

I know this post is really old but, I was wondering if you could tell me
how
to modify your code below to not only change the first instance of
"greater"
but, EACH instance?

Thank you for your help!
Miklo

"Don Guillett" wrote:

this is the idea. modify to suit needs. Perhaps a worksheet_change event?

Sub boldwordinstring()
pos = InStr(ActiveCell, "greater")
With ActiveCell.Characters(Start:=pos, Length:=7).Font
.FontStyle = "Regular"
If pos 0 Then
' .Name = "Courier"
.FontStyle = "Bold"
' .Size = 10
' .Underline = xlUnderlineStyleNone
' .ColorIndex = xlAutomatic
End If
End With
End Sub


--
Don Guillett
SalesAid Software

"Goo" wrote in message
...
For example any time a cell contains the text "greater" I would like
the
font
for the word greater to be bold but not the other text in that cell.







  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How do I conditionally format only some of the text in a cell?

One way:

Option Explicit
Sub boldwordinstring()

Dim myWord As String
Dim Pos As Long

myWord = "greater"

Pos = 0
With ActiveCell
Do
Pos = InStr(Pos + 1, .Value, myWord, vbTextCompare)
If Pos = 0 Then
Exit Do
Else
'found another one
With .Characters(Start:=Pos, Length:=Len(myWord)).Font
.FontStyle = "bold"
End With
End If
Loop
End With
End Sub

Miklo wrote:

Hi Don,

I know this post is really old but, I was wondering if you could tell me how
to modify your code below to not only change the first instance of "greater"
but, EACH instance?

Thank you for your help!
Miklo

"Don Guillett" wrote:

this is the idea. modify to suit needs. Perhaps a worksheet_change event?

Sub boldwordinstring()
pos = InStr(ActiveCell, "greater")
With ActiveCell.Characters(Start:=pos, Length:=7).Font
.FontStyle = "Regular"
If pos 0 Then
' .Name = "Courier"
.FontStyle = "Bold"
' .Size = 10
' .Underline = xlUnderlineStyleNone
' .ColorIndex = xlAutomatic
End If
End With
End Sub


--
Don Guillett
SalesAid Software

"Goo" wrote in message
...
For example any time a cell contains the text "greater" I would like the
font
for the word greater to be bold but not the other text in that cell.





--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default How do I conditionally format only some of the text in a cell?

just to clarify - im trying to change each instance in a single cell.

"Don Guillett" wrote:

this is the idea. modify to suit needs. Perhaps a worksheet_change event?

Sub boldwordinstring()
pos = InStr(ActiveCell, "greater")
With ActiveCell.Characters(Start:=pos, Length:=7).Font
.FontStyle = "Regular"
If pos 0 Then
' .Name = "Courier"
.FontStyle = "Bold"
' .Size = 10
' .Underline = xlUnderlineStyleNone
' .ColorIndex = xlAutomatic
End If
End With
End Sub


--
Don Guillett
SalesAid Software

"Goo" wrote in message
...
For example any time a cell contains the text "greater" I would like the
font
for the word greater to be bold but not the other text in that cell.






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
Cell Capacity - text i2meek Excel Discussion (Misc queries) 4 March 13th 06 12:06 AM
Changing cell format - for example text to numeric sjrku Excel Discussion (Misc queries) 3 December 30th 05 10:40 PM
How to change default cell format to "Text" rbecerra Excel Discussion (Misc queries) 2 September 10th 05 04:29 AM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


All times are GMT +1. The time now is 07:01 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"