Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cherecters and fonts in part of cell
Hi all,
I have a peculer problem. I need to search each selected cell for cherecters HL and replace it with P. It is case sensitive. All the cherecters in the cell have font as aerial, I want font as WINGDINGS 2 only for the replaced cherecter. THE CATCH IS THAT FOR ALL OCCURANCES OF HL IN AERIAL I WANT P IN WINGDING 2 FONT LEAVING REST OF THE CHERECTERS WITH AERIAL FONT. I tried the following code which replaces all the occurances but it changes font only for the 1st occurance. There may be multiple occurances in a single cell. Can somebody tell me whats wrong with this code? Regards, Shetty. My code so far: Sub JI() Dim PP Dim CELL As Range For Each CELL In Selection CELL.Activate PP = InStr(1, ActiveCell, "HL", vbTextCompare) ActiveCell.Replace What:="HL", Replacement:="P", LookAt:=xlPart, SearchOrder _ :=xlByRows, MatchCase:=True, SearchFormat:=False, ReplaceFormat:=False ActiveCell.Characters(Start:=PP, Length:=1).Font.NAME = "wingdings 2" ActiveCell.Characters(Start:=PP, Length:=1).Font.Bold = True Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to mix fonts in a cell? | Excel Discussion (Misc queries) | |||
Search/Match/Find ANY part of string to ANY part of Cell Value | Excel Worksheet Functions | |||
Is it possible to use 2 different fonts in 1 excel cell? | Excel Discussion (Misc queries) | |||
How can I lengthen the drop down Fonts list to show more fonts at | Excel Discussion (Misc queries) | |||
2 different fonts in a cell | Excel Discussion (Misc queries) |