Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filename suffix from a cell

Status
Not open for further replies.

mart10

MIS
Nov 2, 2007
394
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top