{"id":11304,"date":"2019-12-23T16:54:47","date_gmt":"2019-12-23T15:54:47","guid":{"rendered":"https:\/\/www.myexcelonline.com\/?p=11304"},"modified":"2024-02-06T16:16:57","modified_gmt":"2024-02-06T15:16:57","slug":"get-the-count-of-unsaved-workbooks-using-macros-in-excel","status":"publish","type":"post","link":"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/get-the-count-of-unsaved-workbooks-using-macros-in-excel\/","title":{"rendered":"Get the Count of Unsaved Workbooks Using Macros In Excel"},"content":{"rendered":"<p>Have many workbooks open and need a quick survey of unsaved files? Excel <a class=\"wpil_keyword_link\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/101-excel-macros-examples\/\" target=\"_blank\" rel=\"noopener\" title=\"macros\" data-wpil-keyword-link=\"linked\">macros<\/a> will get the <strong>count of unsaved workbooks<\/strong> for you!<\/p>\n<p>Make sure your Excel has the Developer Tab enabled following\u00a0<a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/how-to-create-your-first-macro-button-in-excel-beginners-tutorial\/\" target=\"_blank\" rel=\"noopener noreferrer\">this tutorial<\/a>.<\/p>\n<p>I explain how you can do this below step by step!<\/p>\n<p><em><strong>What does it do?<\/strong><\/em><\/p>\n<p>Gets the count of unsaved workbooks<\/p>\n<p><em><strong>Copy Source Code:<\/strong><\/em><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n\r\nSub GetCountOfUnsavedWorkbooks()\r\n\r\nDim workbook As Workbook\r\nDim counter As Integer\r\n\r\nFor Each workbook In Workbooks\r\n'Count the unsaved workbooks\r\nIf workbook.Saved = False Then\r\ncounter = counter + 1\r\nEnd If\r\nNext workbook\r\n\r\nMsgBox &amp;amp;quot;You have &amp;amp;quot; &amp;amp;amp; counter &amp;amp;amp; &amp;amp;quot; unsaved workbook(s)&amp;amp;quot;\r\n\r\nEnd Sub\r\n\r\n<\/pre>\n<p><em><strong>Final Result:\u00a0<\/strong><\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Get the Count of Unsaved Workbooks Using Macros In Excel\"  class=\"aligncenter size-full wp-image-12040\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06.jpg\" alt=\"Get the Count of Unsaved Workbooks Using Macros In Excel\" width=\"1137\" height=\"439\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06.jpg 1137w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06-300x116.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06-1024x395.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06-768x297.jpg 768w\" sizes=\"(max-width: 1137px) 100vw, 1137px\" \/><\/p>\n<p><em><strong>Exercise Workbooks:<\/strong><\/em><\/p>\n<div class=\"after-post-box\">\n<p class=\"line-two\"><a class=\"IRPP_minimalist icon-download button small\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks.xlsm\" target=\"_blank\" rel=\"noopener noreferrer\" data-leadbox=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks.xlsm\" data-leadbox-id=\"147284833f72a2:12f08263ab46dc\"><span class=\"ctaText px-3 text-capitalize\">Download excel workbook 1<i class=\"fa fa-download\"><\/i><\/span><span class=\"postTitle px-3\">Get-the-Count-of-Unsaved-Workbooks.xlsm<\/span><\/a><\/p>\n<\/div>\n<div class=\"after-post-box\">\n<p class=\"line-two\"><a class=\"IRPP_minimalist icon-download button small\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks2.xlsm\" target=\"_blank\" rel=\"noopener noreferrer\" data-leadbox=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks2.xlsm\" data-leadbox-id=\"147284833f72a2:12f08263ab46dc\"><span class=\"ctaText px-3 text-capitalize\">Download excel workbook 2<i class=\"fa fa-download\"><\/i><\/span><span class=\"postTitle px-3\">Get-the-Count-of-Unsaved-Workbooks2.xlsm<\/span><\/a><\/p>\n<p class=\"line-two\">\n<\/div>\n<hr \/>\n<p>We have 2 workbooks open that have unsaved changes:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Get the Count of Unsaved Workbooks Using Macros In Excel\"  class=\"aligncenter size-full wp-image-12035\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-01.jpg\" alt=\"Get the Count of Unsaved Workbooks Using Macros In Excel\" width=\"678\" height=\"247\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-01.jpg 678w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-01-300x109.jpg 300w\" sizes=\"(max-width: 678px) 100vw, 678px\" \/> <img loading=\"lazy\" decoding=\"async\" title=\"Get the Count of Unsaved Workbooks Using Macros In Excel\"  class=\"aligncenter size-full wp-image-12036\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-02.jpg\" alt=\"Get the Count of Unsaved Workbooks Using Macros In Excel\" width=\"1115\" height=\"333\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-02.jpg 1115w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-02-300x90.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-02-1024x306.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-02-768x229.jpg 768w\" sizes=\"(max-width: 1115px) 100vw, 1115px\" \/> <img loading=\"lazy\" decoding=\"async\" title=\"Get the Count of Unsaved Workbooks Using Macros In Excel\"  class=\"aligncenter size-full wp-image-12037\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-03.jpg\" alt=\"Get the Count of Unsaved Workbooks Using Macros In Excel\" width=\"1137\" height=\"361\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-03.jpg 1137w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-03-300x95.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-03-1024x325.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-03-768x244.jpg 768w\" sizes=\"(max-width: 1137px) 100vw, 1137px\" \/><\/p>\n<p><span style=\"color: #ff0000;\"><strong>STEP 1:<\/strong><\/span>\u00a0In any one of the workbooks, go to\u00a0<em><strong>Developer &gt; Code &gt; Visual Basic<\/strong><\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10906 aligncenter\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-01.jpg\" alt=\"\" width=\"816\" height=\"139\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-01.jpg 816w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-01-300x51.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-01-768x131.jpg 768w\" sizes=\"(max-width: 816px) 100vw, 816px\" title=\"\"><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\"><strong>STEP 2:<\/strong><\/span>\u00a0Paste in your code and\u00a0<strong>Select Save<\/strong>. Close the window afterwards.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Get the Count of Unsaved Workbooks Using Macros In Excel\"  class=\"aligncenter size-full wp-image-12038\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-04.jpg\" alt=\"Get the Count of Unsaved Workbooks Using Macros In Excel\" width=\"1560\" height=\"593\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-04.jpg 1560w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-04-300x114.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-04-1024x389.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-04-768x292.jpg 768w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-04-1536x584.jpg 1536w\" sizes=\"(max-width: 1560px) 100vw, 1560px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\"><strong>STEP 3:\u00a0<\/strong><\/span>Let us test it out!<\/p>\n<p>Go to\u00a0<em><strong>Developer &gt; Code &gt; Macros<\/strong><\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-11245\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Unmerge-Cells-02.jpg\" alt=\"\" width=\"854\" height=\"142\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Unmerge-Cells-02.jpg 854w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Unmerge-Cells-02-300x50.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Unmerge-Cells-02-768x128.jpg 768w\" sizes=\"(max-width: 854px) 100vw, 854px\" title=\"\"><\/p>\n<p>&nbsp;<\/p>\n<p>Make sure your <a class=\"wpil_keyword_link\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/101-excel-macros-examples\/\" target=\"_blank\" rel=\"noopener\" title=\"macro\" data-wpil-keyword-link=\"linked\">macro<\/a> is selected. Click <strong>Run<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Get the Count of Unsaved Workbooks Using Macros In Excel\"  class=\"aligncenter size-full wp-image-12039\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-05.jpg\" alt=\"Get the Count of Unsaved Workbooks Using Macros In Excel\" width=\"613\" height=\"576\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-05.jpg 613w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-05-300x282.jpg 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>With just one click, <strong>you now have the number of unsaved workbooks<\/strong>!<\/p>\n<p><span style=\"color: #0000ff;\"><strong><img loading=\"lazy\" decoding=\"async\" title=\"Get the Count of Unsaved Workbooks Using Macros In Excel\"  class=\"aligncenter size-full wp-image-12040\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06.jpg\" alt=\"Get the Count of Unsaved Workbooks Using Macros In Excel\" width=\"1137\" height=\"439\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06.jpg 1137w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06-300x116.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06-1024x395.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Get-the-Count-of-Unsaved-Workbooks-06-768x297.jpg 768w\" sizes=\"(max-width: 1137px) 100vw, 1137px\" \/><\/strong><\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #0000ff;\"><strong>How to Get the Count of Unsaved Workbooks Using Macros In Excel<\/strong><\/span><br \/>\n<iframe src=\"https:\/\/www.youtube.com\/embed\/Q213PZyumHU?rel=0 \" width=\"800\" height=\"400\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><\/p>\n<p><a href=\"https:\/\/www.youtube.com\/c\/MyExcelOnlinecomtutorials?sub_confirmation=1\" target=\"_blank\" rel=\"noopener noreferrer nofollow\"><img loading=\"lazy\" decoding=\"async\" class=\"alignmiddle wp-image-111468 size-full\" style=\"vertical-align: middle;\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/04\/1.yt_.png\" alt=\"\" title=\"\"><\/a><\/p>\n<p><a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/100-66.html\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13266\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/10\/101-Macros-Book.png\" alt=\"101 Macros Book\" width=\"1200\" height=\"628\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/10\/101-Macros-Book.png 1200w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/10\/101-Macros-Book-300x157.png 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/10\/101-Macros-Book-1024x536.png 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/10\/101-Macros-Book-768x402.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" title=\"\"><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have many workbooks open and need a quick survey of unsaved files? Excel macros will get the count of unsaved workbooks for you! Make sure your Excel has the Developer Tab enabled following\u00a0this tutorial. I explain how you can do this below step by step! What does it do? Gets the count of unsaved workbooks [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":18704,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cos_headline_score":0,"cos_seo_score":0,"cos_headline_text":"","cos_headline_has_been_analyzed":false,"cos_last_analyzed_headline":[],"om_disable_all_campaigns":false},"categories":[56,645],"tags":[106],"acf":[],"_links":{"self":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/11304"}],"collection":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/comments?post=11304"}],"version-history":[{"count":0,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/11304\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media\/18704"}],"wp:attachment":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media?parent=11304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/categories?post=11304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/tags?post=11304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}