<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Merging Excel Sheets (With a Macro?)</title>
	<link>http://ask.metafilter.com/53874/Merging-Excel-Sheets-With-a-Macro/</link>
	<description>Comments on Ask MetaFilter post Merging Excel Sheets (With a Macro?)</description>
	<pubDate>Wed, 27 Dec 2006 11:36:39 -0800</pubDate>
	<lastBuildDate>Wed, 27 Dec 2006 11:36:39 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Merging Excel Sheets (With a Macro?)</title>
		<link>http://ask.metafilter.com/53874/Merging-Excel-Sheets-With-a-Macro</link>	
		<description>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  &lt;br /&gt;&lt;br /&gt; 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 &quot;name&quot; field of the form, and then save the form with a new filename (something like name.xls).&lt;br&gt;
&lt;br&gt;
If this were in any kind of plain text format, I&apos;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).&lt;br&gt;
&lt;br&gt;
Any solutions or even pointers to appropriate search terms would be much appreciated.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.53874</guid>
		<pubDate>Wed, 27 Dec 2006 11:16:29 -0800</pubDate>
		<dc:creator>chrisamiller</dc:creator>
		
			<category>excel</category>
		
			<category>macro</category>
		
			<category>merge</category>
		
			<category>office</category>
		
			<category>resolved</category>
		
	</item> <item>
		<title>By: milkrate</title>
		<link>http://ask.metafilter.com/53874/Merging-Excel-Sheets-With-a-Macro#811673</link>	
		<description>Using the list of names spreadsheet (list.xls), something like this should work:&lt;br&gt;
&lt;br&gt;
Sub makeabunchofspreadsheets()&lt;br&gt;
&lt;br&gt;
For i = 1 to 500 (number of names you have)&lt;br&gt;
Windows(&quot;list.xls&quot;).Activate&lt;br&gt;
name = range(&quot;A1&quot;).offset(i).value&lt;br&gt;
Workbooks.Open Filename:=&quot;C:\blank form.xls&quot;&lt;br&gt;
Windows(&quot;blank form.xls&quot;).Activate&lt;br&gt;
Range(&quot;B1&quot;).value = name (or wherever the name is supposed to go in the spreadsheet)&lt;br&gt;
ActiveWorkbook.SaveAs Filename:=&quot;C:\&quot; &amp;amp; name &amp;amp; &quot;.xls&quot;&lt;br&gt;
ActiveWindow.Close&lt;br&gt;
Next i&lt;br&gt;
&lt;br&gt;
End Sub</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.53874-811673</guid>
		<pubDate>Wed, 27 Dec 2006 11:36:39 -0800</pubDate>
		<dc:creator>milkrate</dc:creator>
	</item><item>
		<title>By: chrisamiller</title>
		<link>http://ask.metafilter.com/53874/Merging-Excel-Sheets-With-a-Macro#811703</link>	
		<description>That&apos;s almost the answer I need.  Running that macro saves copies of the form in correctly renamed files, but the name isn&apos;t being inserted into the form correctly.  &lt;br&gt;
&lt;br&gt;
Instead, the name is being inserted into position B1 of the &quot;list.xls&quot; spreadsheet.&lt;br&gt;
&lt;br&gt;
The &lt;strong&gt;Windows(&quot;blank form.xls&quot;).Activate&lt;/strong&gt; command seems to be working, since that windows pops to the forefront, but the value substitution still occurs in the wrong workbook.&lt;br&gt;
&lt;br&gt;
I throw myself at your mercy, oh excel guru  :)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.53874-811703</guid>
		<pubDate>Wed, 27 Dec 2006 12:07:51 -0800</pubDate>
		<dc:creator>chrisamiller</dc:creator>
	</item><item>
		<title>By: chrisamiller</title>
		<link>http://ask.metafilter.com/53874/Merging-Excel-Sheets-With-a-Macro#811733</link>	
		<description>I figured it out.  For those of you who are curious, or run across this thread later, this is the script I used:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;Sub makeabunchofspreadsheets()&lt;br&gt;
For i = 1 To 885&lt;br&gt;
Windows(&quot;list.xls&quot;).Activate&lt;br&gt;
Name = Range(&quot;A1&quot;).Offset(i).Value&lt;br&gt;
Workbooks.Open Filename:=&quot;C:\test.xls&quot;&lt;br&gt;
Windows(&quot;test.xls&quot;).Activate&lt;br&gt;
Worksheets(&quot;2007&quot;).Range(&quot;A5&quot;) = Name&lt;br&gt;
ActiveWorkbook.SaveAs Filename:=&quot;C:\asdf\&quot; &amp;amp; Name &amp;amp; &quot;.xls&quot;&lt;br&gt;
ActiveWindow.Close&lt;br&gt;
Next i&lt;br&gt;
End Sub&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
Thanks &lt;strong&gt;milkrate&lt;/strong&gt;!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.53874-811733</guid>
		<pubDate>Wed, 27 Dec 2006 12:42:20 -0800</pubDate>
		<dc:creator>chrisamiller</dc:creator>
	</item>
	</channel>
</rss>
