I want to run a macros that stores the data as part of the file name (suffix). At the moment I have the following which can only store with todays date as suffix (NOW). I want to edit the date in a cell and pick up that date to form the file name:
Public RateDate As String
Public SaveDir As String
Public SaveName As String
Sub TrapRates()
Sheets("Top").Select
RateDate = Format(Now, "yymmdd")
/// RateDate = Range("A1").Value - so I would enter date on fron sheet in cell A1, I need this to somehow replace above line
Sheets("Top").Select
SaveDir = Range("B22").Value - front sheet of workbook contains the directory path in cell B22
TrapIRRates
Sub TrapIRRates()
SaveName = "InterestRates_" & RateDate & ".xls"
Sheets("LiveIR").Visible = True
Sheets("LiveIR").Select
Range("IRData").Select
Selection.Copy
Sheets("LiveIR").Visible = False
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
Columns("A:E").AutoFit
ActiveWorkbook.SaveAs Filename:=SaveDir & SaveName
ActiveWorkbook.Close
Windows("Get Bloomberg Rates.xls").Activate
End Sub
Public RateDate As String
Public SaveDir As String
Public SaveName As String
Sub TrapRates()
Sheets("Top").Select
RateDate = Format(Now, "yymmdd")
/// RateDate = Range("A1").Value - so I would enter date on fron sheet in cell A1, I need this to somehow replace above line
Sheets("Top").Select
SaveDir = Range("B22").Value - front sheet of workbook contains the directory path in cell B22
TrapIRRates
Sub TrapIRRates()
SaveName = "InterestRates_" & RateDate & ".xls"
Sheets("LiveIR").Visible = True
Sheets("LiveIR").Select
Range("IRData").Select
Selection.Copy
Sheets("LiveIR").Visible = False
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
Columns("A:E").AutoFit
ActiveWorkbook.SaveAs Filename:=SaveDir & SaveName
ActiveWorkbook.Close
Windows("Get Bloomberg Rates.xls").Activate
End Sub