Hi! I have code which saves a filename based off of a cell value + today's date. How can I adjust it so, if it already exists with value + today's date, it saves as value + date 1, value + date 2, etc? thanks!
VBA Code:
'set Range
Dim lr&: lr = ActiveSheet.Cells.Find("*", [A1], _
xlFormulas, SearchDirection:=xlPrevious).Row
Set WBrng = Range("A1:J" & lr)
WBrng.Copy
Set Wb = Workbooks.Add(1)
With Wb.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
On Error Resume Next
.DrawingObjects.Visible = True
.DrawingObjects.Delete
On Error GoTo 0
Set Wb = ActiveWorkbook ' or a specific open workbook
sPath = CreateObject("WScript.Shell").SpecialFolders("Desktop")
sFile = TraderName & Format(Now(), " mmddyyyy") & ".xlsx"
Wb.SaveAs Filename:=sPath & "\" & sFile
End With
''end