Hello all,
I am working in Excel 2016. I have a VBA code that opens a worksheet and saves date from my current worksheet to the one I just opened. The issue is, I save my file with the VBA code every workday with a new date. I need the - Windows("Daily Position 180126.xlsm").Activate - part of the code to update when I save my new file every day. The code is below and I have highlighted the part I am having issues with.
Sub Risk()
'
' Risk Macro
'
'
ChDir "\\ict0ms06\ntroacct\Trading\TSR Risk Reports\Consolidated Fertilizer"
Workbooks.Open Filename:= _
"\\ict0ms06\ntroacct\Trading\TSR Risk Reports\Consolidated Fertilizer\RiskCalcMasterNewReporting-NEW.xlsx"
Sheets("Daily PNL").Select
Windows("Daily Position 180126.xlsm").Activate
Range("G22:H36").Select
Selection.Copy
Windows("RiskCalcMasterNewReporting-NEW.xlsx").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Send to TSR").Select
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
ActiveWindow.Close
Range("A1").Select
End Sub
So tomorrow I need the red highlighted part of my code to say - Windows("Daily Position 180129.xlsm").Activate - when I roll and save my new file with that name.
Thanks in advance!
Bookmarks