VBA for combining sheets from different workbooks

mojopin

New Member
Joined
Dec 5, 2014
Messages
11
Hi,

I have a folder with plenty workbooks. Each workbook contains multiple sheets. I want to combine one specific sheet (say "Sheet X") from each workbook into sheets in one master workbook, and I want to create a macro that does this. The macro should be able to do the following steps:

1. Remove all cell names from each workbook
2. Combine all the sheets named "Sheet X" into seperate sheets in one master workbook. ("Sheet X", "Sheet X (1)", "Sheet X (2)", etc.)
3. Rename all sheets in the master workbook into cell value in A1 in each sheet.

I have found the following code for combining all sheets in multiple woorkbooks into multiple sheets in one workbook:

Code:
[LEFT][COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Sub</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">MergeExcelFiles()</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">    </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Dim</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">fnameList, fnameCurFile </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">As</code> <code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Variant</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">    </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Dim</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">countFiles, countSheets </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">As</code> <code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Integer</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">    </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Dim</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">wksCurSheet </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">As</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Worksheet</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">    </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Dim</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">wbkCurBook, wbkSrcBook </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">As</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Workbook</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">    </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">fnameList = Application.GetOpenFilename(FileFilter:=</code><code class="vb string" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: blue !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">"Microsoft Excel Workbooks (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm"</code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">, Title:=</code><code class="vb string" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: blue !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">"Choose Excel files to merge"</code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">, MultiSelect:=</code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">True</code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">)</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">    </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">If</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">(vbBoolean <> VarType(fnameList)) </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Then</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">        </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">If</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">(UBound(fnameList) > 0) </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Then</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">countFiles = 0</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">countSheets = 0</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Application.ScreenUpdating = </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">False</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Application.Calculation = xlCalculationManual</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Set</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">wbkCurBook = ActiveWorkbook</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">For</code> <code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Each</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">fnameCurFile </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">In</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">fnameList</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">                </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">countFiles = countFiles + 1</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">                </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Set</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">wbkSrcBook = Workbooks.Open(Filename:=fnameCurFile)</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">                </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">For</code> <code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Each</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">wksCurSheet </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">In</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">wbkSrcBook.Sheets</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">                    </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">countSheets = countSheets + 1</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">                    </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">wksCurSheet.Copy after:=wbkCurBook.Sheets(wbkCurBook.Sheets.Count)</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">                </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Next</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">                </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">wbkSrcBook.Close SaveChanges:=</code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">False</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Next</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Application.ScreenUpdating = </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">True</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Application.Calculation = xlCalculationAutomatic</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">            </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">MsgBox </code><code class="vb string" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: blue !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">"Processed "</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">& countFiles & </code><code class="vb string" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: blue !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">" files"</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">& vbCrLf & </code><code class="vb string" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: blue !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">"Merged "</code> <code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">& countSheets & </code><code class="vb string" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: blue !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">" worksheets"</code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">, Title:=</code><code class="vb string" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: blue !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">"Merge Excel files"</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">        </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">End</code> <code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">If</code>[/FONT][/COLOR]

[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">    </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Else</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">        </code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">MsgBox </code><code class="vb string" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: blue !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">"No files selected"</code><code class="vb plain" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: black !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">, Title:=</code><code class="vb string" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: blue !important; font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">"Merge Excel files"</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(69, 69, 69); font-weight: normal !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">    </code><code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">End</code> <code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">If</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">End</code> <code class="vb keyword" style="font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; white-space: pre-wrap; color: rgb(0, 102, 153) !important; font-weight: bold !important; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;">Sub</code>
[/FONT][/COLOR][/LEFT]

First of all I want do edit this to only combine the sheets names "Sheet X", and not all sheets in all workbooks.
Secondly, when i run this code with my workbooks, I get multiple errors because the workbooks contains similar name lists. This is why I want to remove all cell names.
Thirdly, I want to be able to distinguish all the sheets named "Sheet X ( .) " from each other.

Is it possible to edit the above code to suit my purpose?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try this.
Code:
Option Explicit

Sub MergeExcelFiles()
    Dim fnameList, fnameCurFile As Variant
    Dim countFiles, countSheets As Integer
    Dim wksCurSheet As Worksheet
    Dim wbkCurBook, wbkSrcBook As Workbook
    Dim strSheetName As String
    
    fnameList = Application.GetOpenFilename(FileFilter:="Microsoft Excel Workbooks (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm", Title:="Choose Excel files to merge", MultiSelect:=True)

    strSheetName = "SheetToCopy"
    
    If (vbBoolean <> VarType(fnameList)) Then

        If (UBound(fnameList) > 0) Then
            countFiles = 0
            countSheets = 0

            Application.ScreenUpdating = False
            Application.Calculation = xlCalculationManual

            Set wbkCurBook = ActiveWorkbook

            For Each fnameCurFile In fnameList
                countFiles = countFiles + 1

                Set wbkSrcBook = Workbooks.Open(Filename:=fnameCurFile)

                Set wksCurSheet = wbkSrcBook.Sheets("SheetToCopy")
                
                countSheets = countSheets + 1
                
                Application.DisplayAlerts = False
                wksCurSheet.Copy After:=wbkCurBook.Sheets(wbkCurBook.Sheets.Count)
                Application.DisplayAlerts = True
                
                wbkCurBook.Sheets(wbkCurBook.Sheets.Count).Name = wksCurSheet.Range("A1").Value
                
                wbkSrcBook.Close SaveChanges:=False

            Next

            Application.ScreenUpdating = True
            Application.Calculation = xlCalculationAutomatic

            MsgBox "Processed " & countFiles & " files" & vbCrLf & "Merged " & countSheets & " worksheets", Title:="Merge Excel files"
        End If

    Else
        MsgBox "No files selected", Title:="Merge Excel files"
    End If
    
End Sub
 
Upvote 0
Thank you very much for helping me out :)

Your code succeeded in merging all sheets named "Sheet X" and it avoided the issue with conflicting cell names by simply turning off the display alerts. This is great!
As my sheets contain a lot of data validation, I added "<code class="spaces"></code><code class="plain">Cells.Validation.Delete" to the the code. </code>

However, the code didn't manage to rename all the sheet names to "the value in cell A1. The code runs without any errors, but all the sheets are named "Sheet X", "Sheet X (1)", etc.
 
Upvote 0
Strange, this should rename the sheets with the value from A1 in the original sheet.
Code:
                wbkCurBook.Sheets(wbkCurBook.Sheets.Count).Name = wksCurSheet.Range("A1").Value
Does A1 in those sheets have a value or a formula?
 
Upvote 0
A1 is a value, but with a data validation drop-down list. These lists don't work in the master workbook, and that's why I tried adding the line <code></code><code class="plain">Cells.Validation.Delete.

Code:
Option Explicit

Sub MergeExcelFiles()
    Dim fnameList, fnameCurFile As Variant
    Dim countFiles, countSheets As Integer
    Dim wksCurSheet As Worksheet
    Dim wbkCurBook, wbkSrcBook As Workbook
    Dim strSheetName As String
    
    fnameList = Application.GetOpenFilename(FileFilter:="Microsoft Excel Workbooks (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm", Title:="Choose Excel files to merge", MultiSelect:=True)

    strSheetName = "SheetToCopy"
    
    If (vbBoolean <> VarType(fnameList)) Then

        If (UBound(fnameList) > 0) Then
            countFiles = 0
            countSheets = 0

            Application.ScreenUpdating = False
            Application.Calculation = xlCalculationManual

            Set wbkCurBook = ActiveWorkbook

            For Each fnameCurFile In fnameList
                countFiles = countFiles + 1

                Set wbkSrcBook = Workbooks.Open(Filename:=fnameCurFile)

                Set wksCurSheet = wbkSrcBook.Sheets("Arealbehov 2018")
                [COLOR=#ff0000]Cells.Validation.Delete[/COLOR]
                
                countSheets = countSheets + 1
                
                Application.DisplayAlerts = False
                wksCurSheet.Copy After:=wbkCurBook.Sheets(wbkCurBook.Sheets.Count)
                Application.DisplayAlerts = True
                
                wbkCurBook.Sheets(wbkCurBook.Sheets.Count).Name = wksCurSheet.Range("B4").Value
                
                wbkSrcBook.Close SaveChanges:=False

            Next

            Application.ScreenUpdating = True
            Application.Calculation = xlCalculationAutomatic

            MsgBox "Processed " & countFiles & " files" & vbCrLf & "Merged " & countSheets & " worksheets", Title:="Merge Excel files"
        End If

    Else
        MsgBox "No files selected", Title:="Merge Excel files"
    End If
    
End Sub
</code>
Perhaps the line is added to late in the code?
 
Upvote 0
Might be the opposite, added too early.:)

Try this, it gets the filename from the original sheet before copying it.
Code:
Option Explicit

Sub MergeExcelFiles()
    Dim fnameList, fnameCurFile As Variant
    Dim countFiles, countSheets As Integer
    Dim wksCurSheet As Worksheet
    Dim wbkCurBook, wbkSrcBook As Workbook
    Dim strSheetName As String
    Dim strNewSheetName As String
    
    fnameList = Application.GetOpenFilename(FileFilter:="Microsoft Excel Workbooks (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm", Title:="Choose Excel files to merge", MultiSelect:=True)

    strSheetName = "SheetToCopy"
    
    If (vbBoolean <> VarType(fnameList)) Then

        If (UBound(fnameList) > 0) Then
            countFiles = 0
            countSheets = 0

            Application.ScreenUpdating = False
            Application.Calculation = xlCalculationManual

            Set wbkCurBook = ActiveWorkbook

            For Each fnameCurFile In fnameList
                countFiles = countFiles + 1

                Set wbkSrcBook = Workbooks.Open(Filename:=fnameCurFile)

                Set wksCurSheet = wbkSrcBook.Sheets("SheetToCopy")
                
                strNewSheetName = wksCurSheet.Range("A1").Value
                
                countSheets = countSheets + 1
                
                Application.DisplayAlerts = False
                wksCurSheet.Copy After:=wbkCurBook.Sheets(wbkCurBook.Sheets.Count)
                Application.DisplayAlerts = True
                
                With wbkCurBook.Sheets(wbkCurBook.Sheets.Count)
                    .Name = strNewSheetName
                    .Cells.Validation.Delete
                End With
                
                wbkSrcBook.Close SaveChanges:=False

            Next

            Application.ScreenUpdating = True
            Application.Calculation = xlCalculationAutomatic

            MsgBox "Processed " & countFiles & " files" & vbCrLf & "Merged " & countSheets & " worksheets", Title:="Merge Excel files"
        End If

    Else
        MsgBox "No files selected", Title:="Merge Excel files"
    End If
    
End Sub
 
Upvote 0
Not important, but is it possible to let the sheets be overwrited with new data if the sheet name already exist? This would allow the user to update the master workbook with new information from the sub-workbooks.
 
Upvote 0
Would you want the existing worksheets removed and replace with the new ones or would it be a case of copying only the data from the new ones to the old ones?
 
Upvote 0
Both would probably work fine. There's no need to remove the initial sheets, as long as all the data and formatting is replaced by new data.

In the first case (removed and replaced), it would be important that only the relevant sheets are removed (so a "remove all sheets" code would not work").
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,643
Members
449,093
Latest member
Ahmad123098

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