I have created code to copy and paste a range of cells from one workbook and paste into a new workbook and then save.
What I need to do is add more code to save as a new version, if saving a new batch of records on the same date. Any help would be great thanks
Sub Export()
Dim sPath As String
sPath = Environ("userprofile") & "\Training\"
Dim wbI As Workbook, wbO As Workbook
Dim wsI As Worksheet, wsO As Worksheet
Dim filename As String
'~~> Source/Input Workbook
Set wbI = ThisWorkbook
'~~> Set the relevant sheet from where you want to copy
Set wsI = wbI.Sheets("Reporting")
'~~> Destination/Output Workbook
Set wbO = Workbooks.Add
With wbO
'~~> Set the relevant sheet to where you want to paste
Set wsO = wbO.Sheets("Sheet1")
'~~>. Save the file
filename = wsI.Range("C2").Text
.SaveAs filename:=sPath & Format(Date, "yyyy mm dd ") & filename, FileFormat:=56
'~~> Copy the range
wsI.Range("B6:AA26").Copy
'~~> Paste it in say Cell A1. Change as applicable
wsO.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
wsO.Range("A1").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
.Save
End With
End Sub
Thanks in advance