Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default How to change format for an individual word in a cell

Hi,
I would like to change bold a single word in a cell that has multiple words.
I tried to use find and replace, but the whole cell is bold instead.

Example: B1 contains "Washington Apples". I want to bold all the "Apples"
found in the worksheet.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default How to change format for an individual word in a cell

Hi Jaysan

Try using this macro. All you would do is select a worksheet, run the
macro, enter the word you want to make Bold then click ok. It will
find the word anywhere in the sheet and make it bold.

Hope this helps

Sub BoldChosenWord()
Dim rng As Range
Dim xloop As Long
Dim cll As Long
Dim word As String
Dim wordLength As Long
Dim CllText As Variant
Dim wordStart As Long

Set rng = ActiveSheet.UsedRange
cll = rng.Count

word = InputBox("What word?", "Bold A Word", vbOKCancel)

If word = "" Then Exit Sub
wordLength = Len(word)

For xloop = 1 To cll
CllText = rng.Item(xloop)
If InStr(CllText, word) 0 Then
wordStart = InStr(CllText, word)
rng.Item(xloop).Characters(Start:=wordStart,
Length:=wordLength). _
Font.FontStyle = "Bold"
End If
Next xloop

End Sub


Stuart
www.insightmodelling.co.uk
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format individual coloumn cell with corresponding coloum cell resu Ashok Thapar Excel Worksheet Functions 1 November 26th 08 04:58 AM
Format row color based on individual cell Beawesum Excel Discussion (Misc queries) 3 August 15th 08 08:09 PM
Change individual cell heights/widths in Microsoft Excel 2000 like Microsoft Word urbanplanner Excel Discussion (Misc queries) 3 December 7th 05 03:57 PM
How do I add a hyperlink to an individual word in an Excel cell? Rosalie Excel Discussion (Misc queries) 2 September 28th 05 04:09 AM
How do I change the width of an individual cell? Tabitha Excel Discussion (Misc queries) 3 August 28th 05 06:59 PM


All times are GMT +1. The time now is 12:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"