{"id":1900,"date":"2024-12-06T13:26:55","date_gmt":"2024-12-06T05:26:55","guid":{"rendered":"https:\/\/gotothings.com\/blog\/?p=1900"},"modified":"2025-04-19T20:41:34","modified_gmt":"2025-04-19T12:41:34","slug":"excel-split-each-excel-sheet-into-a-separate-file","status":"publish","type":"post","link":"https:\/\/gotothings.com\/blog\/excel-split-each-excel-sheet-into-a-separate-file\/","title":{"rendered":"Excel: Split Each Excel Sheet Into a Separate File"},"content":{"rendered":"\n<p><em>Was trying to find an automated way of saving all my different Excel Sheets into a single separate file.<\/em><\/p>\n\n\n\n<p><em>Office scripts was not able to do it so end up having to use VBA coding.<\/em><\/p>\n\n\n\n<p>Press ALT + F11 <\/p>\n\n\n\n<p>Copy and Paste VBA codes to Module<\/p>\n\n\n\n<p>Save As file type *.xlsm (macro workbook)<\/p>\n\n\n\n<p><strong>VBA code Start <\/strong><\/p>\n\n\n\n<p>Sub SplitEachWorksheet()<\/p>\n\n\n\n<p>&nbsp; &nbsp; Dim FPath As String<\/p>\n\n\n\n<p>&nbsp; &nbsp; Dim ws As Worksheet<\/p>\n\n\n\n<p>&nbsp; &nbsp; FPath = Application.ActiveWorkbook.Path<\/p>\n\n\n\n<p>&nbsp; &nbsp; Application.ScreenUpdating = False<\/p>\n\n\n\n<p>&nbsp; &nbsp; Application.DisplayAlerts = False<\/p>\n\n\n\n<p>&nbsp; &nbsp; For Each ws In ThisWorkbook.Sheets<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; ws.Copy<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; Application.ActiveWorkbook.SaveAs Filename:=FPath &amp; &#8220;\\&#8221; &amp; ws.Name &amp; &#8220;.xlsx&#8221;, FileFormat:=xlOpenXMLWorkbook<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; Application.ActiveWorkbook.Close False<\/p>\n\n\n\n<p>&nbsp; &nbsp; Next<\/p>\n\n\n\n<p>&nbsp; &nbsp; Application.DisplayAlerts = True<\/p>\n\n\n\n<p>&nbsp; &nbsp; Application.ScreenUpdating = True<\/p>\n\n\n\n<p>End Sub<\/p>\n\n\n\n<p><strong>VBA code Ends<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Was trying to find an automated way of saving all my different Excel Sheets into a single separate file. Office scripts was not able to do it so end up having to use VBA coding. Press ALT + F11 Copy and Paste VBA codes to Module Save As file type *.xlsm (macro workbook) VBA code [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","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,"footnotes":""},"categories":[128],"tags":[],"class_list":["post-1900","post","type-post","status-publish","format-standard","hentry","category-excel"],"_links":{"self":[{"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/posts\/1900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/comments?post=1900"}],"version-history":[{"count":3,"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/posts\/1900\/revisions"}],"predecessor-version":[{"id":1903,"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/posts\/1900\/revisions\/1903"}],"wp:attachment":[{"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/media?parent=1900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/categories?post=1900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gotothings.com\/blog\/wp-json\/wp\/v2\/tags?post=1900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}