Auto Excel file copy and crete files with given names

harinsh

Active Member
Joined
Feb 7, 2012
Messages
273
Hi Team,

I'm looking for one macro code in order to generate the excel files and give the standard excel file names.

Example: I have one master file in the given path like C:\Temp\ and input box required to assign the number of file option. If I declare 10 files then my master file should get 10 copies and save it the above path....

It's really much appreciate if you can provide me the above vba code to get the required output.

Thanks
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Code:
Sub a()
n = InputBox("number of files to save")
fpath = ThisWorkbook.Path
fname = ThisWorkbook.Name
fname = Left(fname, InStr(fname, ".") - 1)
For j = 1 To n
  ThisWorkbook.SaveCopyAs (fname & j & ".xlsm")
Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top