Save excel file as specified titles in different workbook
Closed
Anna
-
6 Jun 2019 à 05:57
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 11 Jun 2019 à 11:36
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 11 Jun 2019 à 11:36
Related:
- Saves workbook with a different name
- Copy worksheet to another workbook vba - Guide
- How to save a webpage as a pdf on mac - Guide
- Workbook vba add - Guide
- Vba copy data from one workbook to another without opening ✓ - Excel Forum
- Elden ring saves location - Guide
3 responses
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
6 Jun 2019 à 12:16
6 Jun 2019 à 12:16
Hi Anna,
It seems I didn't know how to post codes back then :). I always like to recap the question so there is no confusion as to what the code does.
So you have a Master workbook, which has workbook names in column A with a header. Now you want to copy the Master workbook and rename it according to the names mentioned in column A. The copied and renamed workbooks should not contain the code.
For that give the following code a try, but only after replacing the file path:
Best regards,
Trowa
It seems I didn't know how to post codes back then :). I always like to recap the question so there is no confusion as to what the code does.
So you have a Master workbook, which has workbook names in column A with a header. Now you want to copy the Master workbook and rename it according to the names mentioned in column A. The copied and renamed workbooks should not contain the code.
For that give the following code a try, but only after replacing the file path:
Sub RunMe()
Dim x As Integer
Application.DisplayAlerts = False
x = 2
Do
ActiveWorkbook.SaveAs Filename:="C:\Documents\" & Range("A" & x).Value & ".xlsx", FileFormat:=xlOpenXMLWorkbook
x = x + 1
Loop Until Range("A" & x).Value = vbNullString
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub
Best regards,
Trowa
Hi Trowa,
Thank you for your fast response, I appreciate it a lot.
However, I just want to make one correction to the scenario - my master file that has names in column A and macros is in one file, but the copy the macros should be is of another file. So the macros should tell: take the names that are in the home file column A, and go to this file ( separate file - that is just a simple form/ template) > make as many copies of that file as the names are here and title them by names.
That is the task, and you did most part of that. THANK YOU!!!
Will be looking forward to hear from you!
Anna
Thank you for your fast response, I appreciate it a lot.
However, I just want to make one correction to the scenario - my master file that has names in column A and macros is in one file, but the copy the macros should be is of another file. So the macros should tell: take the names that are in the home file column A, and go to this file ( separate file - that is just a simple form/ template) > make as many copies of that file as the names are here and title them by names.
That is the task, and you did most part of that. THANK YOU!!!
Will be looking forward to hear from you!
Anna
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
11 Jun 2019 à 11:36
11 Jun 2019 à 11:36
Hi Anna,
My bad, I missed the separate template file part.
Here you go:
Best regards,
Trowa
My bad, I missed the separate template file part.
Here you go:
Sub RunMe()
Dim x As Integer, wbName As String
x = 2
Do
wbName = Range("A" & x).Value
Workbooks.Open Filename:="C:\Documents\Template File.xlsx"
With ActiveWorkbook
.SaveAs Filename:="C:\Documents\" & wbName & ".xlsx"
.Close
End With
x = x + 1
Loop Until Range("A" & x).Value = vbNullString
End Sub
Best regards,
Trowa