Hello all,
I have some code that I'm using to pull all negative values from one file, and create a new file with the name "Negative Replenishment file". I would like to change my code to add a date to the name in order to avoid t overwriting my previous file. This is the code I've written to copy, create new workbook, and autosave.
Any information is greatly appreciated. Thanks!
D.
I have some code that I'm using to pull all negative values from one file, and create a new file with the name "Negative Replenishment file". I would like to change my code to add a date to the name in order to avoid t overwriting my previous file. This is the code I've written to copy, create new workbook, and autosave.
Code:
Public Sub CopyNeg()
Dim NewWb As Workbook
Dim NewWs As Worksheet
Dim CurWs As Worksheet
Set CurWs = ActiveWorkbook.Worksheets("Replen Report")
Set NewWb = Workbooks.Add
Set NewWs = NewWb.Sheets(1)
CurWs.Range("A:T").AutoFilter Field:=20, Criteria1:="<0"
CurWs.AutoFilter.Range.EntireRow.Copy
NewWs.Range("A1").PasteSpecial xlPasteValuesAndNumberFormats
NewWb.SaveAs "C:\Users\DVelez202\Desktop\VBA Code Files\[B][COLOR=#ff0000]Negative Replenishment file.xlsx[/COLOR][/B]"
End Sub
Any information is greatly appreciated. Thanks!
D.