tjbailey10
New Member
- Joined
- May 20, 2011
- Messages
- 11
Ok to start out we're running Excel 2007 here at the office, but we save files under the older style .xls extention.
We run a report from our QA department on vendor performance. Currently all three purchasers have to go into the file delete sheets that don't apply to them, then save a copy of that file for each vendor, then reopen each worksheet and delete all sheets except for the common refrence sheet and the vendors report card sheet. Its a very annoying process that I'm sure a macro could solve.
So far I have this to seperate the files.
That does a fine job of seperating each sheet into its own file, saving it, and closing it, and I can get it to save to a target directory, but there's a few problems.
1) It saves every file as "Book #" and its impossible for the buyer to know which file applies to each vendor.
2) Each sheet refrences data from another common sheet. So for example sheet "Vendor 1" refrences data from sheet "Master Shipping Data", as does sheet "Vendor 2", "Vendor 3" ect. Would there be a way to tell Excel to save individual sheets along with the "Master Shipping Data" sheet in each workbook. In other words could I have Worksheet 1 have "Master Shipping Data" and "Vendor 1", Worksheet 2 have "Master Shipping Data" and "Vendor 2" ect?
3) Is there a way to tell Excel to save each workbook by the vendors name? The Sheets in the masterwork book are labeled by their vendor so it makes them a little tough to refrence as they're called "Company A", "Company B", "Company C", instead of "Sheet 1", "Sheet 2", "Sheet 3".
This kind of complex scripting is a little over my head. Like I said I was able to get the VBS to make it seperate each sheet into its own workbook and save but unable to get it to save it with a copy of the master shipping data sheet or name the file by the vendor. Any help on this would be huge! Thanks!
We run a report from our QA department on vendor performance. Currently all three purchasers have to go into the file delete sheets that don't apply to them, then save a copy of that file for each vendor, then reopen each worksheet and delete all sheets except for the common refrence sheet and the vendors report card sheet. Its a very annoying process that I'm sure a macro could solve.
So far I have this to seperate the files.
Code:
Sub MakeBooks()
For Each sh in ThisWorkbook.Sheets
With Activeworkbook
.SaveAs "C:\Blah.blah"
.close
End With
Next
End Sub
That does a fine job of seperating each sheet into its own file, saving it, and closing it, and I can get it to save to a target directory, but there's a few problems.
1) It saves every file as "Book #" and its impossible for the buyer to know which file applies to each vendor.
2) Each sheet refrences data from another common sheet. So for example sheet "Vendor 1" refrences data from sheet "Master Shipping Data", as does sheet "Vendor 2", "Vendor 3" ect. Would there be a way to tell Excel to save individual sheets along with the "Master Shipping Data" sheet in each workbook. In other words could I have Worksheet 1 have "Master Shipping Data" and "Vendor 1", Worksheet 2 have "Master Shipping Data" and "Vendor 2" ect?
3) Is there a way to tell Excel to save each workbook by the vendors name? The Sheets in the masterwork book are labeled by their vendor so it makes them a little tough to refrence as they're called "Company A", "Company B", "Company C", instead of "Sheet 1", "Sheet 2", "Sheet 3".
This kind of complex scripting is a little over my head. Like I said I was able to get the VBS to make it seperate each sheet into its own workbook and save but unable to get it to save it with a copy of the master shipping data sheet or name the file by the vendor. Any help on this would be huge! Thanks!