{"id":892,"date":"2020-06-17T15:07:36","date_gmt":"2020-06-17T22:07:36","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=892"},"modified":"2020-06-17T15:08:39","modified_gmt":"2020-06-17T22:08:39","slug":"split-an-excel-workbook-into-multiple-workbooks-by-vba","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=892","title":{"rendered":"Split an EXCEL workbook into multiple workbooks by VBA"},"content":{"rendered":"\n<p>You may need to split a large workbook to separate Excel files with saving each worksheet of the workbook as an individual Excel file. For example, you can split a workbook into multiple individual Excel files and then deliver each file to different person to handle it. By doing so, you can get certain persons handle specific data, and keep your data safe. This article will introduce ways to split a large workbook to separate Excel files based on each worksheet.<\/p>\n\n\n\n<p>The following VBA code can help you quickly split multiple worksheets of current workbook to separate Excel files, please do as follows:<\/p>\n\n\n\n<p><strong>1<\/strong>. Create a new folder for the workbook that you want to split, because the split Excel files will be stayed at the same folder as this master workbook.<\/p>\n\n\n\n<p><strong>2<\/strong>. Hold down the&nbsp;<strong>ALT + F11<\/strong>&nbsp;keys in Excel, and it opens the&nbsp;<strong>Microsoft Visual Basic for Applications<\/strong>&nbsp;window.<\/p>\n\n\n\n<p><strong>3<\/strong>. Click&nbsp;<strong>Insert<\/strong>&nbsp;&gt;&nbsp;<strong>Module<\/strong>, and paste the following code in the Module Window.<\/p>\n\n\n\n<p><strong>VBA: Split a workbook into multiple workbooks and save in the same folder<\/strong><\/p>\n\n\n\n<p><em>Sub Splitbook()<br>&#8216;Updateby20140612<br>Dim xPath As String<br>xPath = Application.ActiveWorkbook.Path<br>Application.ScreenUpdating = False<br>Application.DisplayAlerts = False<br>For Each xWs In ThisWorkbook.Sheets<br>   xWs.Copy<br>   Application.ActiveWorkbook.SaveAs Filename:=xPath &amp; &#8220;\\&#8221; &amp; xWs.Name &amp; &#8220;.xlsx&#8221;<br>   Application.ActiveWorkbook.Close False<br>Next<br>Application.DisplayAlerts = True<br>Application.ScreenUpdating = True<br>End Sub<\/em><\/p>\n\n\n\n<p><strong>4<\/strong>. Press the<strong>&nbsp;F5<\/strong>&nbsp;key to run this code. And the workbook is split to separate Excel files in the same folder with the original workbook. See screenshot:<br><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/cdn.extendoffice.com\/images\/stories\/doc-excel\/split-excel-file\/doc-split-workbook-to-files-vba-01.png\" alt=\"\" width=\"773\" height=\"445\"><\/p>\n\n\n\n<p>Note: If one of the sheets has the same name as the workbook, this VBA cannot work.<\/p>\n\n\n\n<p>Ref: <a href=\"https:\/\/www.extendoffice.com\/documents\/excel\/628-excel-split-workbook.html\">https:\/\/www.extendoffice.com\/documents\/excel\/628-excel-split-workbook.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You may need to split a large workbook to separate Excel files with saving each worksheet of the workbook as an individual Excel file. For example, you can split a workbook into multiple individual Excel files and then deliver each file to different person to handle it. By doing so, you can get certain persons <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=892\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,18],"tags":[],"class_list":["post-892","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-microsoft-office"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/892","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=892"}],"version-history":[{"count":0,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/892\/revisions"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}