ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   find a character and replace with a command in Excel (https://www.excelbanter.com/excel-discussion-misc-queries/96185-find-character-replace-command-excel.html)

Jo

find a character and replace with a command in Excel
 
I need to replace with a formatting command (like you can in Word). I could
set up a macro to do this if it is possible to go to the actual character
within the cells, rather than locating the whole cell.

Dave Peterson

find a character and replace with a command in Excel
 
It's not like MSWord, but you can get to each character of a string (not a
formula!).

For example this bolds colors the 3 character red for the activecell.

Option Explicit
Sub testme02()
Dim myCell As Range
Set myCell = ActiveCell
With myCell.Characters(Start:=3, Length:=1)
.Font.Bold = True
.Font.ColorIndex = 3
End With
End Sub

Jo wrote:

I need to replace with a formatting command (like you can in Word). I could
set up a macro to do this if it is possible to go to the actual character
within the cells, rather than locating the whole cell.


--

Dave Peterson


All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com