I have the following macro in excel..
Sub replace()
'
' replace Macro
' Macro recorded 6/18/2007 by LISC USER
'
Range("B1:CM4000").Select
Selection.replace What:="** ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("B1:CM4000").Select
Selection.replace What:="* ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
Range("B1:CM4000").Select
Selection.replace What:="--", Replacement:="0", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
Range("B1:CM4000").Select
Selection.replace What:="* ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
ActiveWorkbook.Save
End Sub
the macro works great but I have to do it for 50 files all in the same folder(C:\dbase). I know there is a way to loop it and tell it to open, run the macro, save and close, but dont quite remember how to do it.
Sub replace()
'
' replace Macro
' Macro recorded 6/18/2007 by LISC USER
'
Range("B1:CM4000").Select
Selection.replace What:="** ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("B1:CM4000").Select
Selection.replace What:="* ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
Range("B1:CM4000").Select
Selection.replace What:="--", Replacement:="0", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
Range("B1:CM4000").Select
Selection.replace What:="* ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
ActiveWorkbook.Save
End Sub
the macro works great but I have to do it for 50 files all in the same folder(C:\dbase). I know there is a way to loop it and tell it to open, run the macro, save and close, but dont quite remember how to do it.