View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
StuartBisset StuartBisset is offline
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