I have the specified the location and file name on the sheet1 but when i save the file everytime as pdf if the Range.C42 contains the same value the file automatically get replaced. How to create new file if the C42 value is same but without replacing the previous file.
Code
Sub SelectSheetsAndSaveAsPDF()
Dim strPathLocation As String
Dim Filename As String
Dim sheetArray As Variant
strPathLocation = Sheets("sheet1").Range("C41").Value
Filename = Sheets("sheet1").Range("C42").Value
sheetArray = Array("sheet2", "sheet3")
Sheets(sheetArray).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=strPathLocation & Filename
End Sub
Display More