ExceLoki
Active Member
- Joined
- Dec 13, 2021
- Messages
- 481
- Office Version
- 365
- Platform
- Windows
hey all, i'm trying to save the worksheets MOM and SLN each as separate workbook with file name and file path based on separate cell values on the parameters sheet.
thanks in advance!
-----------
-----------
-----------
thanks in advance!
-----------
VBA Code:
Sub CopyItOver()
Path = B15
Filename = B14
Set NewBook = Workbooks.Add
Workbooks("Reporting.xlsm").Worksheets("MOM").Range("A1:AO1000").Copy
NewBook.Worksheets("Sheet1").Range("A1").PasteSpecial
NewBook.SaveAs Filename:=Path & Filename & ".xlsx", FileFormat:=xlNormal
End Sub
Reporting.xlsm | ||||
---|---|---|---|---|
A | B | |||
1 | Parameter | Value | ||
2 | EmployeeID | |||
3 | ||||
4 | 1/1/2019 | |||
5 | *1st day of the previous month | |||
6 | DatabaseServer | |||
7 | Database | |||
8 | ||||
9 | 1/1/2020 | |||
10 | ||||
11 | ||||
12 | ||||
13 | ||||
14 | MOMTermFileName | MOMTermFileName_YYYYMMDD.xlsx | ||
15 | MOMTermPath | C:\Temp\ | ||
Parameters |
-----------