View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] kerry_ja@yahoo.com is offline
external usenet poster
 
Posts: 5
Default Macro Only works Once

Hi all,

I have a problem with macros. I have a macro that used to work as
desired, and now it only works the first time Excel is opened, then it
doesn't run at all:
Sub RemoveLetters()
Selection.Replace What:="a", Replacement:="", MatchCase:=False
Selection.Replace What:="b", Replacement:="", MatchCase:=False
Selection.Replace What:="c", Replacement:="", MatchCase:=False
Selection.Replace What:="d", Replacement:="", MatchCase:=False
Selection.Replace What:="e", Replacement:="", MatchCase:=False
Selection.Replace What:="f", Replacement:="", MatchCase:=False
Selection.Replace What:="g", Replacement:="", MatchCase:=False
Selection.Replace What:="h", Replacement:="", MatchCase:=False
Selection.Replace What:="i", Replacement:="", MatchCase:=False
Selection.Replace What:="j", Replacement:="", MatchCase:=False
Selection.Replace What:="k", Replacement:="", MatchCase:=False
Selection.Replace What:="l", Replacement:="", MatchCase:=False
Selection.Replace What:="m", Replacement:="", MatchCase:=False
Selection.Replace What:="n", Replacement:="", MatchCase:=False
Selection.Replace What:="o", Replacement:="", MatchCase:=False
Selection.Replace What:="p", Replacement:="", MatchCase:=False
Selection.Replace What:="q", Replacement:="", MatchCase:=False
Selection.Replace What:="r", Replacement:="", MatchCase:=False
Selection.Replace What:="s", Replacement:="", MatchCase:=False
Selection.Replace What:="t", Replacement:="", MatchCase:=False
Selection.Replace What:="u", Replacement:="", MatchCase:=False
Selection.Replace What:="v", Replacement:="", MatchCase:=False
Selection.Replace What:="w", Replacement:="", MatchCase:=False
Selection.Replace What:="x", Replacement:="", MatchCase:=False
Selection.Replace What:="y", Replacement:="", MatchCase:=False
Selection.Replace What:="z", Replacement:="", MatchCase:=False
Selection.Replace What:="~*", Replacement:="", MatchCase:=False
Selection.Replace What:="--*", Replacement:="", MatchCase:=False
Selection.Replace What:="-", Replacement:="0", LookAt:=xlWhole,
MatchCase:=False
End Sub

If I close Excel, and then open it again, the macro works once, then
doesn't work again, until I close and reopen Excel.

Any idea why this is?