{"id":11340,"date":"2020-02-21T10:38:59","date_gmt":"2020-02-21T09:38:59","guid":{"rendered":"https:\/\/www.myexcelonline.com\/?p=11340"},"modified":"2024-04-12T22:10:43","modified_gmt":"2024-04-12T20:10:43","slug":"remove-characters-at-the-start-using-macros-in-excel","status":"publish","type":"post","link":"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/remove-characters-at-the-start-using-macros-in-excel\/","title":{"rendered":"Remove Characters at the Start Using Macros In Excel"},"content":{"rendered":"<p>Want to quickly truncate the first number of characters of your choosing? 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> can remove characters at the start of your selection of text!<\/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>Removes the number of characters at the start as specified by the user<\/p>\n<p><em><strong>Copy Source Code:<\/strong><\/em><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n\r\nSub RemoveCharactersAtTheStart()\r\n\r\nDim range As Range\r\nDim num As Integer\r\n\r\nGet the &lt;a href=&quot;https:\/\/www.myexcelonline.com\/meo-staging\/blog\/remove-character-from-string\/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;characters to be removed from&lt;\/a&gt; the user\r\nnum = InputBox(&amp;amp;quot;Input the number of characters to remove at the start&amp;amp;quot;, &amp;amp;quot;Num of characters&amp;amp;quot;)\r\n\r\n'Loop through all of the text\r\nFor Each range In Selection\r\n'Use Right to remove the first x characters\r\nrange = Right(range, Len(range) - num)\r\nNext range\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=\"Insert Time Range Using Macros In Excel\" class=\"aligncenter size-full wp-image-12326\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-05.jpg\" alt=\"Insert Time Range Using Macros In Excel\" width=\"364\" height=\"323\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-05.jpg 364w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-05-300x266.jpg 300w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><\/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\/5tTFBqDo4l4?rel=0 \" width=\"800\" height=\"400\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span data-mce-type=\"bookmark\" style=\"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\/03\/Remove-Characters-at-the-Start.xlsm\" target=\"_blank\" rel=\"noopener noreferrer\" data-leadbox=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start.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\">Remove-Characters-at-the-Start.xlsm<\/span><\/a><\/p>\n<p class=\"line-two\">\n<\/div>\n<hr \/>\n<p>This is the text that we want to modify. We want to <a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/remove-text-in-excel\/\" target=\"_blank\" rel=\"noopener\">remove the first 2 characters<\/a> of these Part Numbers:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Insert Time Range Using Macros In Excel\" class=\"aligncenter size-full wp-image-12322\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-01.jpg\" alt=\"Insert Time Range Using Macros In Excel\" width=\"321\" height=\"343\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-01.jpg 321w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-01-281x300.jpg 281w\" sizes=\"(max-width: 321px) 100vw, 321px\" \/><\/p>\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\" 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=\"Insert Time Range Using Macros In Excel\" class=\"aligncenter size-full wp-image-12323\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-02.jpg\" alt=\"Insert Time Range Using Macros In Excel\" width=\"1507\" height=\"745\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-02.jpg 1507w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-02-300x148.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-02-1024x506.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-02-768x380.jpg 768w\" sizes=\"(max-width: 1507px) 100vw, 1507px\" \/><\/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>Open the sheet containing the data. 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 part numbers and <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> are selected. Click <strong>Run<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Insert Time Range Using Macros In Excel\" class=\"aligncenter size-full wp-image-12324\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-03.jpg\" alt=\"Insert Time Range Using Macros In Excel\" width=\"1007\" height=\"615\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-03.jpg 1007w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-03-300x183.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-03-768x469.jpg 768w\" sizes=\"(max-width: 1007px) 100vw, 1007px\" \/><\/p>\n<p>We want to remove the first 2 characters. Type in 2 and <strong>Click OK<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Insert Time Range Using Macros In Excel\" class=\"aligncenter size-full wp-image-12325\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-04.jpg\" alt=\"Insert Time Range Using Macros In Excel\" width=\"1048\" height=\"321\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-04.jpg 1048w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-04-300x92.jpg 300w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-04-1024x314.jpg 1024w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-04-768x235.jpg 768w\" sizes=\"(max-width: 1048px) 100vw, 1048px\" \/><\/p>\n<p>With just one click, <strong>the first 2 <a href=\"https:\/\/www.myexcelonline.com\/meo-staging\/blog\/remove-last-character-from-strings\/\" target=\"_blank\" rel=\"noopener\">characters are now all removed<\/a><\/strong>!<\/p>\n<p><span style=\"color: #0000ff\"><strong> <img loading=\"lazy\" decoding=\"async\" title=\"Insert Time Range Using Macros In Excel\" class=\"aligncenter size-full wp-image-12326\" src=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-05.jpg\" alt=\"Insert Time Range Using Macros In Excel\" width=\"364\" height=\"323\" srcset=\"https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-05.jpg 364w, https:\/\/www.myexcelonline.com\/meo-staging\/wp-content\/uploads\/2019\/03\/Remove-Characters-at-the-Start-05-300x266.jpg 300w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><\/strong><\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #0000ff\"><strong>How to Remove Characters at the Start 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>Want to quickly truncate the first number of characters of your choosing? Excel Macros can remove characters at the start of your selection of text! 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? Removes the number of [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":18090,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"cos_headline_score":0,"cos_seo_score":0,"cos_headline_text":"Remove Characters at the Start Using Macros In Excel","cos_headline_has_been_analyzed":false,"cos_last_analyzed_headline":[],"om_disable_all_campaigns":false},"categories":[56,641],"tags":[106],"acf":[],"_links":{"self":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/11340"}],"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=11340"}],"version-history":[{"count":0,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/posts\/11340\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media\/18090"}],"wp:attachment":[{"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/media?parent=11340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/categories?post=11340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myexcelonline.com\/meo-staging\/wp-json\/wp\/v2\/tags?post=11340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}