View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
JulieD JulieD is offline
external usenet poster
 
Posts: 12
Default Using Macros to bold specified text in Excel

Hi Frank

thought so, thanks for confirming it for me ... never know until you ask :)

Cheers
JulieD

"Frank Kabel" wrote in message
...
Hi Julie
with conditional format you can only change the whole cell. For parts
of a cell you have to use a event procedure (similar to the one Ken
provided)

--
Regards
Frank Kabel
Frankfurt, Germany

JulieD wrote:
Hi Ken

thanks for this - and now for my next question - can you use
conditional formatting to bold / change colour one word in a cell?
or do you just use the code you supplied on the worksheet_change
event?

Cheers
JulieD



"Ken Wright" wrote in message
...
Hi Julie, you can you know (Bold and colour them anyway - not change
the pattern partially though). :-)

This will prompt you for the string and then highlight all instances
on the activesheet.

Sub ColText()

Dim i As Long
Dim j As Integer
Dim k As Integer
Dim num As Long
Dim ans As String
Dim str As String

ans = InputBox("What string do you want to find")
i = Application.WorksheetFunction.CountIf(ActiveSheet. UsedRange, "*"
& ans & "*")
j = Len(ans)


Cells.Find(what:=ans, after:=ActiveCell, LookIn:=xlValues,
lookat:= _ xlPart, MatchCase:=False).Activate
k = Application.WorksheetFunction.Find(ans, ActiveCell)

For num = 1 To i

With ActiveCell.Characters(Start:=k, Length:=j).Font

'THE COLORINDEX BIT WILL COLOUR IT RED AS WELL - DELETE OR
'COMMENT IT OUT IF YOU DON'T WANT IT

.ColorIndex = 3
.Bold = True

End With

Cells.FindNext(after:=ActiveCell).Activate
Next num

End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

--------------------------------------------------------------------

------
-- It's easier to beg forgiveness than ask permission :-)
--------------------------------------------------------------------

------



"JulieD" wrote in message
...
Hi

have you tried format / conditional formatting - its easier that
writing macros - BTW (as far as i know) you can't bold or highlight
parts of a cell in excel, if that's what you're trying to achieve.

Cheers
JulieD

"Need Help" wrote in message
...
I am trying to create a macro that searches a column for specified
text and Bolds or Highlights all instances.

This is easy in Word but I couldn't find the feature in EXCEL.

Thanks.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.598 / Virus Database: 380 - Release Date: 28/02/2004