Changing selected text format

P

Prosperina

FRANK: It's just one word in particular, not a pattern.

RYAN: Unfortunately, I'm not familiar with inserting VBA modules bu
I'll give it a shot.

Thanks
 
R

Ryan Poth

Prosperina,

I'll try and walk you through it as best I can. I'm using Excel 2002, so the
procedure may be slightly different if you're on a different version, but
here goes anyway.

While in your spreadsheet, select from the menu Tools->Macro->Visual Basic
Editor

This should bring up the Visual Basic Editor (VBA) window. In this window
(NOT the Excel window), select from the menu Insert->Module

This should bring up a blank module. Copy the code from my previous posting
and paste it into this window.

There will be two lines that got chopped in half by the newsgroup, in order
to fit onto the screen. You will need to re-join these (4) lines into 2 as
follows:

The line that starts 'c.Characters...' should end with '...= "Bold"'. If
this has been split into two lines, rejoin them into one by going to the
start of the second line pressing back-space.

The line that starts 'SearchStart = Instr...' should end with
'...Len(MyWord'. Again, if it has been split, re-join the two lines as you
did before.

Now, to make sure everything worked, from the menu (VB, not Excel) select
Debug->Compile VBA Project. If you get no messages, it all worked fine. If
you do get a message, you probably haven't re-joined the lines properly.

If all is OK, you can now close the VBA window and go back to Excel. You are
ready to use the new macro.

Select the range of cells you want to affect and then, from the menus,
select Tools->Macros->Macro. click on the macro named "MakeWordBold" and
press "Run".

You should see a popup asking you to enter a string (or 'sting', since I had
a type in my posting). Enter that exact string you want to make bold and
press "OK".

If everything worked as planned, your string should now be converted to bold
in the entire selection.

Good luck and hope that helps.
Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top