{"id":10872,"date":"2019-01-29T14:51:56","date_gmt":"2019-01-29T13:51:56","guid":{"rendered":"https:\/\/www.myexcelonline.com\/?p=10872"},"modified":"2024-02-06T16:14:48","modified_gmt":"2024-02-06T15:14:48","slug":"how-to-insert-multiple-columns-using-macros-in-excel","status":"publish","type":"post","link":"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/how-to-insert-multiple-columns-using-macros-in-excel\/","title":{"rendered":"How to Insert Multiple Columns Using Macros in Excel"},"content":{"rendered":"<p>Ever wanted to try to\u00a0<strong>insert multiple columns<\/strong> just by typing in a number?\u00a0It is possible using <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> in Excel!<\/p>\n<p>Plus you also get to learn some programming tricks along the way, how cool is that?<\/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>Asks for a number of columns, then inserts it to the right of your selected cell<\/p>\n<p><em><strong>Copy Source Code:<\/strong><\/em><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n\r\nSub InsertMultipleColumns()\r\n\r\nDim numColumns As Integer\r\nDim counter As Integer\r\n\r\n'Select the current column\r\nActiveCell.EntireColumn.Select\r\nOn Error GoTo Last\r\nnumColumns = InputBox(&amp;amp;quot;Enter number of columns to insert&amp;amp;quot;, &amp;amp;quot;Insert Columns&amp;amp;quot;)\r\n\r\n'Keep on insert columns until we reach the desired number\r\nFor counter = 1 To numColumns\r\nSelection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromRightorAbove\r\nNext counter\r\nLast: Exit Sub\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=\"How to Insert Multiple Columns Using Macros in Excel\"  class=\"aligncenter size-full wp-image-10912\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06.jpg\" alt=\"How to Insert Multiple Columns Using Macros in Excel\" width=\"1031\" height=\"260\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06.jpg 1031w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06-300x76.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06-1024x258.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06-768x194.jpg 768w\" sizes=\"(max-width: 1031px) 100vw, 1031px\" \/><\/p>\n<p><em><strong>Exercise Workbook:<\/strong><\/em><\/p>\n<div class=\"after-post-box\">\n<p><iframe src=\"https:\/\/www.youtube.com\/embed\/TmvxEmhUNuk?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><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 class=\"line-two\"><a class=\"IRPP_minimalist icon-download button small\" href=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns.xlsm\" target=\"_blank\" rel=\"noopener noreferrer\" data-leadbox=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns.xlsm\" data-leadbox-id=\"147284833f72a2:12f08263ab46dc\"><span class=\"ctaText px-3 text-capitalize\">Download excel workbook<i class=\"fa fa-download\"><\/i><\/span><span class=\"postTitle px-3\">How-to-Insert-Multiple-Columns.xlsm<\/span><\/a><\/p>\n<p class=\"line-two\">\n<\/div>\n<hr \/>\n<p><span style=\"color: #ff0000;\"><strong>STEP 1:<\/strong><\/span>\u00a0Go to\u00a0<em><strong>Developer &gt; Code &gt; Visual Basic<\/strong><\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"How to Insert Multiple Columns Using Macros in Excel\"  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=\"How to Insert Multiple Columns Using Macros in Excel\" 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\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\"><strong>STEP 2:<\/strong><\/span> Paste in your code and\u00a0<strong>Select Save<\/strong>. Close the window afterwards.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"How to Insert Multiple Columns Using Macros in Excel\"  class=\"size-full wp-image-10908 aligncenter\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-02.jpg\" alt=\"How to Insert Multiple Columns Using Macros in Excel\" width=\"1162\" height=\"534\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-02.jpg 1162w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-02-300x138.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-02-1024x471.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-02-768x353.jpg 768w\" sizes=\"(max-width: 1162px) 100vw, 1162px\" \/><\/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>Select any cell that you want to insert columns on. Go to\u00a0<em><strong>Developer &gt; Code &gt; Macros<\/strong><\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"How to Insert Multiple Columns Using Macros in Excel\"  class=\"size-full wp-image-10909 aligncenter\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-03.jpg\" alt=\"How to Insert Multiple Columns Using Macros in Excel\" width=\"866\" height=\"383\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-03.jpg 866w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-03-300x133.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-03-768x340.jpg 768w\" sizes=\"(max-width: 866px) 100vw, 866px\" \/><\/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=\"How to Insert Multiple Columns Using Macros in Excel\"  class=\"size-full wp-image-10910 aligncenter\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-04.jpg\" alt=\"How to Insert Multiple Columns Using Macros in Excel\" width=\"381\" height=\"363\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-04.jpg 381w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-04-300x286.jpg 300w\" sizes=\"(max-width: 381px) 100vw, 381px\" \/><\/p>\n<p>We want to insert 3 columns. <strong>Type in 3<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"How to Insert Multiple Columns Using Macros in Excel\"  class=\"size-full wp-image-10911 aligncenter\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-05.jpg\" alt=\"How to Insert Multiple Columns Using Macros in Excel\" width=\"359\" height=\"152\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-05.jpg 359w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-05-300x127.jpg 300w\" sizes=\"(max-width: 359px) 100vw, 359px\" \/><\/p>\n<p>With that, you are now able to insert multiple columns using macros!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"How to Insert Multiple Columns Using Macros in Excel\"  class=\"aligncenter size-full wp-image-10912\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06.jpg\" alt=\"How to Insert Multiple Columns Using Macros in Excel\" width=\"1031\" height=\"260\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06.jpg 1031w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06-300x76.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06-1024x258.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/01\/How-to-Insert-Multiple-Columns-06-768x194.jpg 768w\" sizes=\"(max-width: 1031px) 100vw, 1031px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #0000ff;\"><strong>How to Insert Multiple Columns Using Macros in Excel<\/strong><\/span><\/p>\n<p>&nbsp;<\/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>Ever wanted to try to\u00a0insert multiple columns just by typing in a number?\u00a0It is possible using Macros in Excel! Plus you also get to learn some programming tricks along the way, how cool is that? Make sure your Excel has the Developer Tab enabled following\u00a0this tutorial. I explain how you can do this below step [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":17706,"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,639],"tags":[243,568,371],"acf":[],"_links":{"self":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/10872"}],"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=10872"}],"version-history":[{"count":0,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/10872\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media\/17706"}],"wp:attachment":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media?parent=10872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/categories?post=10872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/tags?post=10872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}