creating 37 workbooks with names based on cells

timwe

New Member
Joined
Dec 22, 2016
Messages
12
Hi,

I have an Excel template that needs to be sent out to 37 different people/areas. I would like to duplicate this template without having to "save as" 37 times.

Can someone help with a VBA code that recreates the workbook 37 times and names it after a list of names in a column?

br
timwe
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
You shouldn't change Environ("UserName"). This special function will "grab" the actual username from the computer where this code is run from.

Next you are missing some important backslashes, so change to this (exactly):
SaveFolder = "C:\Users\" & Environ("UserName") & "\Desktop\Procurement"

If you don't have a backslash as the first character of each cell in column U, you also need a backslash after Procurement, like this:
SaveFolder = "C:\Users\" & Environ("UserName") & "\Desktop\Procurement\"

Just a minor tip, A change I would suggest for this and future code would be the following:
Code:
SaveFolder = Environ("UserProfile") & "\Desktop\Procurement"
Code:
SaveFolder = Environ("UserProfile") & "\Desktop\Procurement[COLOR=#FF0000][B]\[/B][/COLOR]"
Admittedly most Windows computers these days probably have their profile on C:\Users so in most cases this would end up being the same thing but it's not guaranteed and this could potentially avoid a bug down the road.
 
Upvote 0
That's a good point. I was assuming that the file path would be changed anyways, so I just used a convenient one as a place holder, but yes, that's a better coding procedure in the end.
 
Upvote 0
Ah, you're probably right. When I saw that the problem had been solved I didn't read his case very carefully, saw that little bit of code and thought the tip might help. Guess I should read more carefully. :LOL:
 
Upvote 0

Forum statistics

Threads
1,215,030
Messages
6,122,762
Members
449,095
Latest member
m_smith_solihull

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