Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default conditional formatting only applies to part of cell text

I only want the condtional formatting to apply to the part of the text that
equals "PCC". For example, the value of the cell may be, "Jane Smith - PCC"
and I only want PCC to be bold and green and Jane Smith to remain the same.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 461
Default conditional formatting only applies to part of cell text

That would require VBA coding. Theres no way to do that with the normal
conditional formatting that excel gives you.

"klkropf" wrote:

I only want the condtional formatting to apply to the part of the text that
equals "PCC". For example, the value of the cell may be, "Jane Smith - PCC"
and I only want PCC to be bold and green and Jane Smith to remain the same.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default conditional formatting only applies to part of cell text

Do you know what the VBA code would be?

"akphidelt" wrote:

That would require VBA coding. Theres no way to do that with the normal
conditional formatting that excel gives you.

"klkropf" wrote:

I only want the condtional formatting to apply to the part of the text that
equals "PCC". For example, the value of the cell may be, "Jane Smith - PCC"
and I only want PCC to be bold and green and Jane Smith to remain the same.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 461
Default conditional formatting only applies to part of cell text

to be honest I've never done this before so I really do not know. I imagine
you would have to loop through the range of cells everytime, search the cell
for the given word you want using StrComp or something, then some how select
the word within the sentence using some kind of find and range formulas and
then change the color to whatever you want.

It's possible but I'm not the man for the answer

"klkropf" wrote:

Do you know what the VBA code would be?

"akphidelt" wrote:

That would require VBA coding. Theres no way to do that with the normal
conditional formatting that excel gives you.

"klkropf" wrote:

I only want the condtional formatting to apply to the part of the text that
equals "PCC". For example, the value of the cell may be, "Jane Smith - PCC"
and I only want PCC to be bold and green and Jane Smith to remain the same.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default conditional formatting only applies to part of cell text

Sub Bold_String()
Dim rng As Range
Dim Cell As Range
Dim start_str As Integer
Set rng = Selection
For Each Cell In rng
start_str = InStr(Cell.Value, "PCC")
If start_str Then
With Cell.Characters(start_str, 3).Font
.Bold = True
.ColorIndex = 10
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Mon, 5 May 2008 16:08:01 -0700, klkropf
wrote:

Do you know what the VBA code would be?

"akphidelt" wrote:

That would require VBA coding. Theres no way to do that with the normal
conditional formatting that excel gives you.

"klkropf" wrote:

I only want the condtional formatting to apply to the part of the text that
equals "PCC". For example, the value of the cell may be, "Jane Smith - PCC"
and I only want PCC to be bold and green and Jane Smith to remain the same.




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 461
Default conditional formatting only applies to part of cell text

Wow, I just tested that out... that is pretty sweet.

"Gord Dibben" wrote:

Sub Bold_String()
Dim rng As Range
Dim Cell As Range
Dim start_str As Integer
Set rng = Selection
For Each Cell In rng
start_str = InStr(Cell.Value, "PCC")
If start_str Then
With Cell.Characters(start_str, 3).Font
.Bold = True
.ColorIndex = 10
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Mon, 5 May 2008 16:08:01 -0700, klkropf
wrote:

Do you know what the VBA code would be?

"akphidelt" wrote:

That would require VBA coding. Theres no way to do that with the normal
conditional formatting that excel gives you.

"klkropf" wrote:

I only want the condtional formatting to apply to the part of the text that
equals "PCC". For example, the value of the cell may be, "Jane Smith - PCC"
and I only want PCC to be bold and green and Jane Smith to remain the same.



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default conditional formatting only applies to part of cell text

Thanks, I can get it to work if PCC is actually typed in the cell, but I'm
using a Vlookup to return the value. Will it work when doing that?

"Gord Dibben" wrote:

Sub Bold_String()
Dim rng As Range
Dim Cell As Range
Dim start_str As Integer
Set rng = Selection
For Each Cell In rng
start_str = InStr(Cell.Value, "PCC")
If start_str Then
With Cell.Characters(start_str, 3).Font
.Bold = True
.ColorIndex = 10
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Mon, 5 May 2008 16:08:01 -0700, klkropf
wrote:

Do you know what the VBA code would be?

"akphidelt" wrote:

That would require VBA coding. Theres no way to do that with the normal
conditional formatting that excel gives you.

"klkropf" wrote:

I only want the condtional formatting to apply to the part of the text that
equals "PCC". For example, the value of the cell may be, "Jane Smith - PCC"
and I only want PCC to be bold and green and Jane Smith to remain the same.



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default conditional formatting only applies to part of cell text

Not unless you were to change the cell to a value.

You cannot format parts of formula results.


Gord

On Mon, 5 May 2008 17:18:01 -0700, klkropf
wrote:

Thanks, I can get it to work if PCC is actually typed in the cell, but I'm
using a Vlookup to return the value. Will it work when doing that?

"Gord Dibben" wrote:

Sub Bold_String()
Dim rng As Range
Dim Cell As Range
Dim start_str As Integer
Set rng = Selection
For Each Cell In rng
start_str = InStr(Cell.Value, "PCC")
If start_str Then
With Cell.Characters(start_str, 3).Font
.Bold = True
.ColorIndex = 10
End With
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Mon, 5 May 2008 16:08:01 -0700, klkropf
wrote:

Do you know what the VBA code would be?

"akphidelt" wrote:

That would require VBA coding. Theres no way to do that with the normal
conditional formatting that excel gives you.

"klkropf" wrote:

I only want the condtional formatting to apply to the part of the text that
equals "PCC". For example, the value of the cell may be, "Jane Smith - PCC"
and I only want PCC to be bold and green and Jane Smith to remain the same.




  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default conditional formatting only applies to part of cell text

@Gord Dibben Thanks a lot for your Code.....it helped a lot :)

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
Conditional Formatting part 2 Arturo Excel Worksheet Functions 1 June 28th 07 06:34 PM
Subtotals & Conditional Formatting Part 2 Studebaker Excel Worksheet Functions 1 May 17th 07 09:19 AM
conditional formatting "if part of cell contents contains string" tom ossieur Excel Worksheet Functions 1 March 13th 07 11:11 AM
Conditional formatting for part of a cell Marie Bayes Excel Discussion (Misc queries) 7 September 8th 06 06:47 PM
Conditional Formatting - part of cell only RobDDrums Excel Discussion (Misc queries) 1 January 9th 06 11:11 PM


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