Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro stops running after file has moved
Hello,
I have a macro that goes through an entire workbook and replaces every instance of NOW() with the current date - 1 year. I recorded the macro and received some help on the proper syntax for replacing with the year old date. After using the code I ran the macro and it worked. I then created a button and copied the code into it and that worked fine as well. After making multiple copies and running the macro and button repeatedly I copied the workbook onto my network and asked someone else to test it. This failed so I copied the file back to my hard drive and got it to running again by running the replace manually. After the manual run I started copying back new copies from the network again and they ran fine. Another copy saved to the network stopped working again. Any ideas why this is happening? Sheets("Vac&Sick").Select Range("K1").Select Cells.Replace What:="NOW()", Replacement:="date(" & Year(Date) - 1 & ",12, 31)", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Application.CutCopyMode = False Range("B2").Select ActiveWorkbook.Save LWhite |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro stops running after file has moved
This failed
Not much to go on. If the tester had Excel 2000 or earlier the "SearchFormat:=False, _ ReplaceFormat:=False" part will fail since it's not supported. You can safely delete it I think. -- Jim Rech Excel MVP "LWhite" wrote in message ... | Hello, | | I have a macro that goes through an entire workbook and | replaces every instance of NOW() with the current date - | 1 year. I recorded the macro and received some help on | the proper syntax for replacing with the year old date. | After using the code I ran the macro and it worked. I | then created a button and copied the code into it and | that worked fine as well. | | After making multiple copies and running the macro and | button repeatedly I copied the workbook onto my network | and asked someone else to test it. This failed so I | copied the file back to my hard drive and got it to | running again by running the replace manually. After the | manual run I started copying back new copies from the | network again and they ran fine. Another copy saved to | the network stopped working again. | | Any ideas why this is happening? | | Sheets("Vac&Sick").Select | Range("K1").Select | Cells.Replace What:="NOW()", Replacement:="date(" & | Year(Date) - 1 & ",12, 31)", LookAt:= _ | xlPart, SearchOrder:=xlByRows, MatchCase:=False, | SearchFormat:=False, _ | ReplaceFormat:=False | Application.CutCopyMode = False | Range("B2").Select | ActiveWorkbook.Save | | LWhite |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code Stops Running Instead of Debugging | Excel Discussion (Misc queries) | |||
Instead of debugging, code just stops running | Excel Discussion (Misc queries) | |||
Opening a file stops a Macro | Excel Worksheet Functions | |||
why excel stops running?? | Excel Discussion (Misc queries) | |||
I moved a file from work to home and now my color macro does not w | Excel Worksheet Functions |