Harshil Mehta
Board Regular
- Joined
- May 14, 2020
- Messages
- 85
- Office Version
- 2013
- Platform
- Windows
I have total 6 sheets in my excel workbook from which I want to make a save as of first 5 sheets whose sheet names are based on cell value of sheet(6) E17,F17,G17,H17.I17 [Sheet Name is DASHBOARD]. So if the value in the cell changes the names of the sheets also changes. Please find below the code and would be thankful if anyone could help me.
Sub Make_SaveAs()
Worksheets(Array(Sheets(1), Sheets(2), Sheets(3), Sheets(4), Sheets(5))).Copy
With ActiveWorkbook
.SaveAs Filename:=Environ("USERPROFILE") & "\Desktop\" & Format(Now(), "YYYYMMDD HHMM") & " " & ThisWorkbook.Sheets(3).Range("C2") & " Design Format.xlsx", FileFormat:=xlOpenXMLWorkbook
.Close SaveChanges:=False
End With
MsgBox "File Saved on Deskstop"
End Sub
VBA Code:
Worksheets(Array(Sheets(1), Sheets(2), Sheets(3), Sheets(4), Sheets(5))).Copy
With ActiveWorkbook
.SaveAs Filename:=Environ("USERPROFILE") & "\Desktop\" & Format(Now(), "YYYYMMDD HHMM") & " " & ThisWorkbook.Sheets(3).Range("C2") & " Design Format.xlsx", FileFormat:=xlOpenXMLWorkbook
.Close SaveChanges:=False
End With
MsgBox "File Saved on Deskstop"
End Sub