Solved

How to add Date Stamp to Excel spreadsheet name with Macro

Posted on 2016-10-27
4
59 Views
Last Modified: 2016-10-31
Hi Guys, the 3rd Macro on this Excel spreadsheet saves the worksheet with the title "Provider Analysis" and then sends it out via Outlook. How can I add Today's date stamp to the VB code so at the end, the spreadsheet name is "Provider Analysis 28 October 2016"? I send it out every day so the date stamp must change every day too.
ProviderAnalysisHA_PR_NEW.xlsm
0
Comment
Question by:JCutcliffe
  • 2
4 Comments
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
ID: 41863204
Add something like

& Format(Now(),"dd mmm yyyy")
0
 
LVL 18

Accepted Solution

by:
Roy_Cox earned 250 total points
ID: 41863413
Your code uses saveas in at least three procedures. You might want to change them all.

Sub Macro3()
'
' Macro3 Macro
'

'

    Sheets(Array("Synth", "LiqProv", "LiqProvDetail", "LiqProvUSD", "LiqProvAED", _
                 "LiqProvEUR")).Copy
    ChDir "Y:\Cash & Collateral\LiquidityProvider"
    ActiveWorkbook.SaveAs Filename:= _
                          "Y:\Cash & Collateral\LiquidityProvider\LiqProvider" & Format(Date, "dd mmmm yyyy") & ".xlsx", FileFormat:= _
                          xlOpenXMLWorkbook, CreateBackup:=False
    Application.Dialogs(xlDialogSendMail).Show
End Sub

Open in new window



Also, glancing through the rest of your code you seem to have a lot of redundant code created by the Macro Recorder which should be tidied up, e.g. unnecessary selecting, lines like  ActiveWindow.SmallScroll Down:=6 can all be deleted.
0
 

Author Closing Comment

by:JCutcliffe
ID: 41867576
fab
0
 
LVL 18

Expert Comment

by:Roy_Cox
ID: 41867943
Pleased to help
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question