Merging Excel Sheets (With a Macro?)
December 27, 2006 11:16 AM
Subscribe
MS Excel help needed. I need to set up some sort of automated merging macro in excel and am having trouble tracking down the best way. The details, and much
I have two spreadsheets - the first is a form with some pretty formatting, and the second is a list of several hundred names. I need to set up a macro or script that will take each name from the list, stick it in the "name" field of the form, and then save the form with a new filename (something like name.xls).
If this were in any kind of plain text format, I'd whip up a perl script, but I have little experience using advanced Excel features. Using the Office 2003 XML format is also not an option, because these have to work with older versions of Excel (Office 2000).
Any solutions or even pointers to appropriate search terms would be much appreciated.
posted by chrisamiller to computers & internet (3 comments total)
1 user marked this as a favorite
Sub makeabunchofspreadsheets()
For i = 1 to 500 (number of names you have)
Windows("list.xls").Activate
name = range("A1").offset(i).value
Workbooks.Open Filename:="C:\blank form.xls"
Windows("blank form.xls").Activate
Range("B1").value = name (or wherever the name is supposed to go in the spreadsheet)
ActiveWorkbook.SaveAs Filename:="C:\" & name & ".xls"
ActiveWindow.Close
Next i
End Sub
posted by milkrate at 11:36 AM on December 27, 2006