Replace word with Bold words

metalkitty

New Member
Joined
Nov 9, 2005
Messages
35
Hi-

This is (I believe a really easy question) I just can't seem to think straight...

In my excel spreadsheet, I basically want to search the whole spreadsheet for one word, ex. DOG and replace it with the word, DOG in Bold.

Any help with replacing with a format I would really appreciate.

Thanks much
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Welcome to MrExcel - will DOG be the only thing in the cell, or might there also be a cell holding

Beware of dog ...

that would also require bolding?
 
Upvote 0
Is DOG the only text in the cell?

If so then you could use conditional formatting.
 
Upvote 0
Actuallly it would be something like Beware of Dog...

and I would only want Dog to be bolded in the cell

Beware of Dog

Thanks again
 
Upvote 0
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> foo1()
<SPAN style="color:#00007F">Dim</SPAN> FirstAddress <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, c <SPAN style="color:#00007F">As</SPAN> Range, Tgt <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
Tgt = Application.InputBox("Enter your target now: ", , , , , , , 2)
Application.ScreenUpdating = <SPAN style="color:#00007F">False</SPAN>
<SPAN style="color:#00007F">With</SPAN> Cells
    <SPAN style="color:#00007F">On</SPAN> <SPAN style="color:#00007F">Error</SPAN> <SPAN style="color:#00007F">Resume</SPAN> <SPAN style="color:#00007F">Next</SPAN>
    <SPAN style="color:#00007F">Set</SPAN> c = .Find(Tgt, LookIn:=xlValues, LookAt:=xlPart)
    <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> c <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN>
        FirstAddress = c.Address
        <SPAN style="color:#00007F">Do</SPAN>
            <SPAN style="color:#00007F">If</SPAN> c.HasFormula = <SPAN style="color:#00007F">True</SPAN> <SPAN style="color:#00007F">Then</SPAN>
            <SPAN style="color:#00007F">ElseIf</SPAN> Len(c.Value) = Len(Tgt) <SPAN style="color:#00007F">Then</SPAN>
                c.Font.Bold = <SPAN style="color:#00007F">True</SPAN>
            <SPAN style="color:#00007F">Else</SPAN>
                i = InStr(1, c.Value, Tgt)
                c.Characters(i, Len(Tgt)).Font.Bold = <SPAN style="color:#00007F">True</SPAN>
            <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
            <SPAN style="color:#00007F">Set</SPAN> c = .FindNext(c)
        <SPAN style="color:#00007F">Loop</SPAN> <SPAN style="color:#00007F">While</SPAN> <SPAN style="color:#00007F">Not</SPAN> c <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> And c.Address <> FirstAddress
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
Application.ScreenUpdating = <SPAN style="color:#00007F">True</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>


</FONT>

Limited testing.

Will not alter dog which is a result of formulas.
 
Upvote 0

Forum statistics

Threads
1,203,263
Messages
6,054,434
Members
444,725
Latest member
madhink

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top