View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
TheYellowDart TheYellowDart is offline
external usenet poster
 
Posts: 1
Default Selection.Find.Replacement.ClearFormatting


I need to set the word "testing" and "result" in all my cells on
particular page to underlined. Normally I would do this manually
however, as there are so many items (over 2000 rows) I was hoping
could write a macro to solve this.

Here is what I've come up with;however, I get an error on the firs
line (excel 2003)

Sub UnderlineWord()

Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Underline = True
With Selection.Find
.Text = "testing"
.Replacement.Text = "testing"
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

I've tried doing a replace funtion using formatting; however, Exce
changes the entire contents of the cell to underlined when it change
one word. The cell has multiple rows in it with ALT-Returns and need
to only underline the words "testing" and "result"

I think the code is close but I'm missing something.

Thanks in advance to anyone that can help :

--
TheYellowDar
-----------------------------------------------------------------------
TheYellowDart's Profile: http://www.excelforum.com/member.php...fo&userid=2654
View this thread: http://www.excelforum.com/showthread.php?threadid=39816