Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default Replace a format of a part of a cell

Any idea how to have just a single word or part of text of a cell for example
"Amount" wherever occurring on the sheet be converted to be in red colored
font?

--
Best Regards,

Faraz
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Replace a format of a part of a cell

Hi,

Try this

Private Sub Worksheet_Change(ByVal Target As Range)
If InStr(UCase(Target.Value), "AMOUNT") = 0 Then Exit Sub
With Target.Characters(Start:=InStr(UCase(Target.Value) , "AMOUNT"),
Length:=6).Font
.ColorIndex = 3
End With
End Sub

Mike

"Faraz A. Qureshi" wrote:

Any idea how to have just a single word or part of text of a cell for example
"Amount" wherever occurring on the sheet be converted to be in red colored
font?

--
Best Regards,

Faraz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Replace a format of a part of a cell

or if you wanted to check an already populated sheet try this

Sub missive()
For Each c In ActiveSheet.UsedRange
If InStr(1, c.Value, "AMOUNT", vbTextCompare) 0 Then
With c.Characters(Start:=InStr(1, c.Value, _
"AMOUNT", vbTextCompare), Length:=6).Font
.ColorIndex = 3
End With
End If
Next
End Sub

Mike

"Mike H" wrote:

Hi,

Try this

Private Sub Worksheet_Change(ByVal Target As Range)
If InStr(UCase(Target.Value), "AMOUNT") = 0 Then Exit Sub
With Target.Characters(Start:=InStr(UCase(Target.Value) , "AMOUNT"),
Length:=6).Font
.ColorIndex = 3
End With
End Sub

Mike

"Faraz A. Qureshi" wrote:

Any idea how to have just a single word or part of text of a cell for example
"Amount" wherever occurring on the sheet be converted to be in red colored
font?

--
Best Regards,

Faraz

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default Replace a format of a part of a cell

XClent!
--
Best Regards,

Faraz


"Mike H" wrote:

or if you wanted to check an already populated sheet try this

Sub missive()
For Each c In ActiveSheet.UsedRange
If InStr(1, c.Value, "AMOUNT", vbTextCompare) 0 Then
With c.Characters(Start:=InStr(1, c.Value, _
"AMOUNT", vbTextCompare), Length:=6).Font
.ColorIndex = 3
End With
End If
Next
End Sub

Mike

"Mike H" wrote:

Hi,

Try this

Private Sub Worksheet_Change(ByVal Target As Range)
If InStr(UCase(Target.Value), "AMOUNT") = 0 Then Exit Sub
With Target.Characters(Start:=InStr(UCase(Target.Value) , "AMOUNT"),
Length:=6).Font
.ColorIndex = 3
End With
End Sub

Mike

"Faraz A. Qureshi" wrote:

Any idea how to have just a single word or part of text of a cell for example
"Amount" wherever occurring on the sheet be converted to be in red colored
font?

--
Best Regards,

Faraz

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Replace a format of a part of a cell

Glad I could help


"Faraz A. Qureshi" wrote:

XClent!
--
Best Regards,

Faraz


"Mike H" wrote:

or if you wanted to check an already populated sheet try this

Sub missive()
For Each c In ActiveSheet.UsedRange
If InStr(1, c.Value, "AMOUNT", vbTextCompare) 0 Then
With c.Characters(Start:=InStr(1, c.Value, _
"AMOUNT", vbTextCompare), Length:=6).Font
.ColorIndex = 3
End With
End If
Next
End Sub

Mike

"Mike H" wrote:

Hi,

Try this

Private Sub Worksheet_Change(ByVal Target As Range)
If InStr(UCase(Target.Value), "AMOUNT") = 0 Then Exit Sub
With Target.Characters(Start:=InStr(UCase(Target.Value) , "AMOUNT"),
Length:=6).Font
.ColorIndex = 3
End With
End Sub

Mike

"Faraz A. Qureshi" wrote:

Any idea how to have just a single word or part of text of a cell for example
"Amount" wherever occurring on the sheet be converted to be in red colored
font?

--
Best Regards,

Faraz

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
replace part text in a cell Indra Excel Discussion (Misc queries) 3 December 8th 08 03:29 AM
Find & Replace part of cell contents JASelep Excel Programming 3 October 15th 07 10:25 PM
REPLACE PART OF CELL WITH FORMATTED TEXT Manju Excel Worksheet Functions 8 December 27th 06 11:42 PM
Macro to evaluate a cell and replace one part of the formula John[_114_] Excel Programming 2 January 19th 06 07:31 PM
Search & Replace Formatting for part of cell Tanya B Excel Programming 3 June 30th 05 01:58 PM


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