Sub JustRepairOrder()
'
' JustRepairOrder Macro
' Copy and saves the repair order to its file name then erases everything so you can start the next one
'
' saves Just vehicle repair order with the file name taken from cell r54
' saves repair order with the file name taken from cell r54 in roreq folder
Sheets("Just vehicle repair order").Select
ActiveSheet.Unprotect
Sheets("Just vehicle repair order").Copy
thisfile = Range("r54").Value
strFolder$ = "D:\new sws folder\maintenance\roreq\" & Split(thisfile, "-")(1)
If Len(Dir$(strFolder$, vbDirectory)) = 0 Then MkDir strFolder$
' this is ware the debugger takes me
ActiveWorkbook.SaveAs Filename:=strFolder$ & "\" & thisfile
' breaks links
ActiveWorkbook.BreakLink Name:= _
"D:\new sws folder\Maintenance\Orl1 Mechanics Work.xlsm", Type:=xlExcelLinks
' saves the changes
ActiveWorkbook.Save
ActiveWorkbook.Close
' Clears the contents from Just vehicle repair order to start over
ActiveSheet.Unprotect
' Clears the old just vehicle repair order
With Sheets("just vehicle repair order")
Range("AR2:AV5").ClearContents
Range("AB4:AK5").ClearContents
Range("I8:AV17").ClearContents
Range("C8:G8").ClearContents
Range("C13:G13").ClearContents
Range("C36:G36").ClearContents
Range("C43:G44").ClearContents
Range("C46:G47").ClearContents
Range("C49:G50").ClearContents
Range("C52:G53").ClearContents
Range("I21:AT46").ClearContents
Range("I49:Q50").ClearContents
Range("R49:AE50").ClearContents
Range("AB51:AL53").ClearContents
End With
ActiveSheet.Protect
Range("AB4:AK5").Select
ActiveWorkbook.Save
End Sub
Bookmarks