ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection.Find.Replacement.ClearFormatting (https://www.excelbanter.com/excel-programming/338058-selection-find-replacement-clearformatting.html)

TheYellowDart

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


TheYellowDart[_2_]

Selection.Find.Replacement.ClearFormatting
 

Thank you everyone!!!!

You've saved the day.. :)

Hip Hip Hooray...Hip Hip Hooray :) :) :)


--
TheYellowDart
------------------------------------------------------------------------
TheYellowDart's Profile: http://www.excelforum.com/member.php...o&userid=26549
View this thread: http://www.excelforum.com/showthread...hreadid=398164



All times are GMT +1. The time now is 06:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com