View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
[email protected] RJQMAN@gmail.com is offline
external usenet poster
 
Posts: 46
Default Make 1st word in cell bold after combining words from two cell

On Jun 5, 1:22*am, Joel wrote:
Jim and my approach are really identical. *I just have some additional
options that can be eliminated and added a method if you want to change the
rest of the cell.

I think the problem is the activecell is not the activecell but some other
cell. * Or it should be FontStyle instead of Font. *try modifying Jim's code
as follows

Sub FewAreBold()
* Dim N As Long
* N = InStr(1, Range("A1").Text, " ", vbTextCompare)
* Range("A1").Characters(1, N)..FontStyle.Bold = True
End Sub



" wrote:
On Jun 5, 12:01 am, "Jim Cone" wrote:
Sub FewAreBold()
* Dim N As Long
* N = InStr(1, ActiveCell.Text, " ", vbTextCompare)
* ActiveCell.Characters(1, N).Font.Bold = True
End Sub
--
Jim Cone
Portland, Oregon *USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


wrote in message


I am combining the words from two cells, and I would like to change
the font of the first word in the combined cell. *However, I keep
getting the font of the entire cell to change.
The cell has this formula, which draws text from two other pages in
the workbook, and it works fine
=Paragraphs!C8&" "&Details!B2
The first cell has about 60 characters in it, and the second cell
about 30 or so. *The length of the first cell never varies, but the
length of the second cell does.
OK. *So now the correct text is in the target cell. *Now I want to
make the first word bold-face. *I could not figure out how to do it
without VBA, so I tried to do this in single statement in a VBA
subroutine. *It caused the entire cell to turn bold face..


ActiveCell.Characters(Start:=1, Length:=1).Font.FontStyle = "Bold"


What can I do? *Any help is appreciated.


I have tried the approach suggested by Jim, and the entire cell turns
bold face. *Then I tried the longer approach suggested by Joel, and
nothing happens at all. *Joel, I did change to cell reference to the
cell in question that contains the combined text. *Excel does not seem
to recognize the first word in the combined text box.- Hide quoted text -


- Show quoted text -


I am sorry, I run into the exact same problem. I changed the reference
cell from A1 to the cell I am working in, D17, and once again the
entire cell turns bold.

For more reference, the reference cell is drawing from two other
cells. One cell (a1) contains this phrase - "Property: The property
is located at" and the second combined cell (B2) says "15 Elm
Street." Cell D17 contains the formula. The combined cell, D17,
reads "Property: The property is located at 15 Elm Street." It all
works fine, except I would like to change the first word text to Bold
Face...I hope this clarifies. I am up against a wall ad do not
understand why...

Does this help??