View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove Harlan Grove is offline
external usenet poster
 
Posts: 733
Default REPLACE PART OF CELL WITH FORMATTED TEXT

Manju wrote...
....
I meant to change a vast range of cells which has other persons
initials also along with mine (SM) in a single cell to know all the
places where my name is appearing.
If i need to select each cell individually and change the formatting it
doesn't serve my purpose. I hope you have a solution.


The only way to make batch formatting changes to SUBSTRINGS of cell
contents is by macro. If you're willing to use macros, and if the
initials you want to change are SM always appearing between the first
and second instance of /, and if you preselect the cells involved, you
could use the following macro.

Sub foo()
Const INITIALS As String = "hg" & "/"

Dim c As Range, s As String, n As Long, p As Long

If Not TypeOf Selection Is Range Then Exit Sub

n = Len(INITIALS)

For Each c In Selection
s = c.Text
p = InStr(1, s, "/") + 1

If p 1 And Mid(s, p, n) = INITIALS Then
With c.Characters(p, n - 1)
.Font.Bold = True
.Font.Italic = True
.Font.ColorIndex = 5 'blue - change as needed

End With

End If

Next c

End Sub

How do I attach a excel file if I want to show you the actual
spreadsheet with problem ?


Don't. I don't open files from people I don't know, and anyone else
with any sense would also refuse to open your file. Plain text
descriptions are almost always sufficient.