Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Macro not working in Excel?

Status
Not open for further replies.

ljjtek

Technical User
Feb 26, 2001
35
US
I have a macro that I use in Word to find and replace certain text, so I thought I could use this same code in Excel, but its giving me an error.....this is an example from the code....what's wrong?!
Sub days()

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Monday"
.Replacement.Text = "Mon"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

End Sub
 
I'd suggest recording the macro in excel to give you a start to the code you want
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top