View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben[_2_] Gord Dibben[_2_] is offline
external usenet poster
 
Posts: 621
Default Bold items within text string

Your example is quite simple and I imagine you need more but here's a start.

Select your range of hard-coded cells and run this macro to bold Bob in all
cells.

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, "Bob")
If start_str Then
cell.Characters(start_str, 3).Font.Bold = True
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 9 Jun 2011 13:48:49 -0700 (PDT), Steve
wrote:

Rick,

I created a formula in a cell to do what I wanted, then hard-coded the
entire column. Now I have a column of values, with no formulas. I
tried to do a simple Replace (ie find Bob and replace with Bob in
bold), but found that when it finds the text string I'm trying to
replace, it adjusts all contents of the cell.

On Jun 9, 11:49*am, Steve wrote:
Thanks Rick. *I'm certainly willing, but have no idea how to do that!

On Jun 9, 11:36*am, "Rick Rothstein"



wrote:
Thanks Rick. *How about this - since the parts of the text string I
want bolded are constant (ie, column headers J$1:N$1), can I read
the column headers in variables, and do a FIND routine to find
each column header in the text string and then bold?


You cannot bold individual parts or text generated by a formula... there is
no way around that using formulas. If you were willing to turn the
calculating of the formula to VB in a Change event procedure, then you could
have that procedure inject pure text into the cell and that text, being a
constant, could be bolded in parts.


Rick Rothstein (MVP - Excel)- Hide quoted text -


- Show quoted text -