0

I have a macro that saves an Excel file with file name that includes the previous day date. It works fine, but I also want to include in the file name a text that exists in another sheet (sheet name is DSP) and in cell B8

This is the code I have:

ActiveWorkbook.SaveAs Filename:= _
        "\\mypath\" & _
    "Azal PHR " & Format(Date - 1, "mm-dd-yyyy")
DecimalTurn
  • 3,243
  • 3
  • 16
  • 36
hussam
  • 11
  • 2

1 Answers1

0

Just need to concatenate the workbook and sheet reference to the end. Note you may need to change the workbook name depending on the file extension (e.g. if it has macros as well it will be .xlsm)

ActiveWorkbook.SaveAs Filename:= "\\mypath\" & "Azal PHR " & _ 
Format(Date - 1, "mm-dd-yyyy") & _ 
Excel.Workbooks("PHR Automatic.xlsx").Worksheets("DSP").Range("B8").Value
Alexander
  • 310
  • 1
  • 9