{"id":119,"date":"2018-11-07T18:53:00","date_gmt":"2018-11-07T18:53:00","guid":{"rendered":"http:\/\/www.vbastring.com\/blog\/?p=119"},"modified":"2019-02-17T21:08:52","modified_gmt":"2019-02-17T21:08:52","slug":"how-to-parse-with-the-vba-split-function","status":"publish","type":"post","link":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/","title":{"rendered":"How To Parse With The VBA Split Function"},"content":{"rendered":"<p>So you get a list of names and your boss wants you to separate the last name and the first name into different columns.<br \/>\nMany time you want to do this so you can sort by either the first name or last name columns.<\/p>\n<p>You can use the vba &#8220;split&#8221; function for this purpose. <\/p>\n<p>Step 1:<br \/>\nFind out the last row in your list.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_1.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_1.png?resize=298%2C906\" alt=\"vba_split_function_1\" width=\"298\" height=\"906\" class=\"aligncenter size-full wp-image-121\" \/><\/a><\/p>\n<p>Step 2:<br \/>\nGo into the VBE editor and set up a module with a For loop.<\/p>\n<p>Press Alt + F11<br \/>\nRight Click and insert module.<\/p>\n<p>Add this code to your module:<\/p>\n<pre class=\"lang:vb decode:true \" >Sub VBASplitFunction()\r\n    Dim intRow As Integer\r\n    \r\n    Dim strWholeName As String\r\n    Dim varWholeName As Variant\r\n    \r\n    Dim strFName As String\r\n    Dim strLName As String\r\n    \r\n    For intRow = 2 To 28\r\n        strWholeName = Range(\"A\" &amp; intRow)\r\n        \r\n        'the split function creates an array based on the delimiter specified for the parsing\r\n        varWholeName = Split(strWholeName, \" \")\r\n        \r\n        'parse the array into 2 variables\r\n        strFName = varWholeName(0)\r\n        strLName = varWholeName(1)\r\n        \r\n        'add them to the worksheet currently active\r\n        Range(\"B\" &amp; intRow) = strFName\r\n        Range(\"C\" &amp; intRow) = strLName\r\n        \r\n    Next\r\n    \r\nEnd Sub\r\n<\/pre>\n<p>After you run the code (Press F5 on your keyboard), you&#8217;ll have parsed your columns!<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_2b.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_2b.png?resize=416%2C712\" alt=\"vba_split_function_2b\" width=\"416\" height=\"712\" class=\"aligncenter size-full wp-image-126\" \/><\/a><\/p>\n<p>Let me know if you have any questions<\/p>\n<p>[simple_contact_form]\t<\/p>\n<p>****************************************************<\/p>\n<table border=\"1\" width=\"100%\">\n<tr>\n<td align=\"middle\">\n<div class=\"AW-Form-1094354588\"><\/div>\n<p><script type=\"text\/javascript\">(function(d, s, id) {\n    var js, fjs = d.getElementsByTagName(s)[0];\n    if (d.getElementById(id)) return;\n    js = d.createElement(s); js.id = id;\n    js.src = \"\/\/forms.aweber.com\/form\/88\/1094354588.js\";\n    fjs.parentNode.insertBefore(js, fjs);\n    }(document, \"script\", \"aweber-wjs-kkrwj13ov\"));\n<\/script>\n<\/td>\n<\/tr>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>So you get a list of names and your boss wants you to separate the last name and the first name into different columns. Many time you want to do this so you can sort by either the first name or last name columns. You can use the vba &#8220;split&#8221; function for this purpose. Step [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","om_disable_all_campaigns":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-119","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Parse With The VBA Split Function - My Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Parse With The VBA Split Function - My Blog\" \/>\n<meta property=\"og:description\" content=\"So you get a list of names and your boss wants you to separate the last name and the first name into different columns. Many time you want to do this so you can sort by either the first name or last name columns. You can use the vba &#8220;split&#8221; function for this purpose. Step [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/\" \/>\n<meta property=\"og:site_name\" content=\"My Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-07T18:53:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-17T21:08:52+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_1.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/#\\\/schema\\\/person\\\/e1de0b30e98940381697872449c341f5\"},\"headline\":\"How To Parse With The VBA Split Function\",\"datePublished\":\"2018-11-07T18:53:00+00:00\",\"dateModified\":\"2019-02-17T21:08:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/\"},\"wordCount\":127,\"image\":{\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.vbastring.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/vba_split_function_1.png\",\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/\",\"url\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/\",\"name\":\"How To Parse With The VBA Split Function - My Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.vbastring.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/vba_split_function_1.png\",\"datePublished\":\"2018-11-07T18:53:00+00:00\",\"dateModified\":\"2019-02-17T21:08:52+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/#\\\/schema\\\/person\\\/e1de0b30e98940381697872449c341f5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/#primaryimage\",\"url\":\"http:\\\/\\\/www.vbastring.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/vba_split_function_1.png\",\"contentUrl\":\"http:\\\/\\\/www.vbastring.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/vba_split_function_1.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/2018\\\/11\\\/07\\\/how-to-parse-with-the-vba-split-function\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Parse With The VBA Split Function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/\",\"name\":\"My Blog\",\"description\":\"My WordPress Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/#\\\/schema\\\/person\\\/e1de0b30e98940381697872449c341f5\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b2feaa698a4bd91b409df1beb5ff6acc2d7842d4f78543d413ebd468bc0171af?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b2feaa698a4bd91b409df1beb5ff6acc2d7842d4f78543d413ebd468bc0171af?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b2feaa698a4bd91b409df1beb5ff6acc2d7842d4f78543d413ebd468bc0171af?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\\\/\\\/vbastring.com\\\/blog\"],\"url\":\"https:\\\/\\\/vbastring.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Parse With The VBA Split Function - My Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/","og_locale":"en_US","og_type":"article","og_title":"How To Parse With The VBA Split Function - My Blog","og_description":"So you get a list of names and your boss wants you to separate the last name and the first name into different columns. Many time you want to do this so you can sort by either the first name or last name columns. You can use the vba &#8220;split&#8221; function for this purpose. Step [&hellip;]","og_url":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/","og_site_name":"My Blog","article_published_time":"2018-11-07T18:53:00+00:00","article_modified_time":"2019-02-17T21:08:52+00:00","og_image":[{"url":"http:\/\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_1.png","type":"","width":"","height":""}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/#article","isPartOf":{"@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/"},"author":{"name":"admin","@id":"https:\/\/vbastring.com\/blog\/#\/schema\/person\/e1de0b30e98940381697872449c341f5"},"headline":"How To Parse With The VBA Split Function","datePublished":"2018-11-07T18:53:00+00:00","dateModified":"2019-02-17T21:08:52+00:00","mainEntityOfPage":{"@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/"},"wordCount":127,"image":{"@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/#primaryimage"},"thumbnailUrl":"http:\/\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_1.png","inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/","url":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/","name":"How To Parse With The VBA Split Function - My Blog","isPartOf":{"@id":"https:\/\/vbastring.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/#primaryimage"},"image":{"@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/#primaryimage"},"thumbnailUrl":"http:\/\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_1.png","datePublished":"2018-11-07T18:53:00+00:00","dateModified":"2019-02-17T21:08:52+00:00","author":{"@id":"https:\/\/vbastring.com\/blog\/#\/schema\/person\/e1de0b30e98940381697872449c341f5"},"breadcrumb":{"@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/#primaryimage","url":"http:\/\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_1.png","contentUrl":"http:\/\/www.vbastring.com\/blog\/wp-content\/uploads\/2018\/11\/vba_split_function_1.png"},{"@type":"BreadcrumbList","@id":"https:\/\/vbastring.com\/blog\/2018\/11\/07\/how-to-parse-with-the-vba-split-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vbastring.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Parse With The VBA Split Function"}]},{"@type":"WebSite","@id":"https:\/\/vbastring.com\/blog\/#website","url":"https:\/\/vbastring.com\/blog\/","name":"My Blog","description":"My WordPress Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vbastring.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/vbastring.com\/blog\/#\/schema\/person\/e1de0b30e98940381697872449c341f5","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b2feaa698a4bd91b409df1beb5ff6acc2d7842d4f78543d413ebd468bc0171af?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b2feaa698a4bd91b409df1beb5ff6acc2d7842d4f78543d413ebd468bc0171af?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b2feaa698a4bd91b409df1beb5ff6acc2d7842d4f78543d413ebd468bc0171af?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/vbastring.com\/blog"],"url":"https:\/\/vbastring.com\/blog\/author\/admin\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/posts\/119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/comments?post=119"}],"version-history":[{"count":5,"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/posts\/119\/revisions"}],"predecessor-version":[{"id":522,"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/posts\/119\/revisions\/522"}],"wp:attachment":[{"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/media?parent=119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/categories?post=119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vbastring.com\/blog\/wp-json\/wp\/v2\/tags?post=119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}