metricsboy
New Member
- Joined
- Dec 10, 2012
- Messages
- 28
The below code works beautiful; it will modify the old, saveas a new wb then continue to modify old wbs until it has opened all wbs in Excel. Can I add code to it to kill the old wb ?
Sub rev_final()
'
' rev_final Macro
'
' Keyboard Shortcut: Ctrl+h
'
Range("P1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(R[1]C[-13],""__"",R[1]C[-12],""__"",R[1]C[-14])"
Range("P1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Cells.Replace What:="/", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False, _
FormulaVersion:=xlReplaceFormula2
Cells.Replace What:=":", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False, _
FormulaVersion:=xlReplaceFormula2
fName = Range("P1").Value
'Change the date format to whatever you'd like, but make sure it's in quotes
NewFile = fName
' Change directory to suit your PC, including USER NAME
ChDir _
"C:\Users\Paul.Mccarty\OneDrive - Kenco Group\Documents\Pre-Inspections\2023-10-OCT - copy"
ActiveWorkbook.SaveAs Filename:=NewFile
ActiveWorkbook.Close True
Application.Run "PERSONAL.XLSB!rev_final"
End Sub
Sub rev_final()
'
' rev_final Macro
'
' Keyboard Shortcut: Ctrl+h
'
Range("P1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(R[1]C[-13],""__"",R[1]C[-12],""__"",R[1]C[-14])"
Range("P1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Cells.Replace What:="/", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False, _
FormulaVersion:=xlReplaceFormula2
Cells.Replace What:=":", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False, _
FormulaVersion:=xlReplaceFormula2
fName = Range("P1").Value
'Change the date format to whatever you'd like, but make sure it's in quotes
NewFile = fName
' Change directory to suit your PC, including USER NAME
ChDir _
"C:\Users\Paul.Mccarty\OneDrive - Kenco Group\Documents\Pre-Inspections\2023-10-OCT - copy"
ActiveWorkbook.SaveAs Filename:=NewFile
ActiveWorkbook.Close True
Application.Run "PERSONAL.XLSB!rev_final"
End Sub