{"id":560,"date":"2013-03-03T15:16:03","date_gmt":"2013-03-03T15:16:03","guid":{"rendered":"http:\/\/excelvbatutor.com\/?page_id=560"},"modified":"2020-04-23T11:00:59","modified_gmt":"2020-04-23T11:00:59","slug":"excel-vba-lesson-5-sub-procedure-functions","status":"publish","type":"page","link":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-5-sub-procedure-functions\/","title":{"rendered":"Excel VBA Lesson 5: Sub Procedures and Functions"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\"><strong><a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-4-operators-in-excel-vba\/\">&lt;&lt;Lesson 4&gt;&gt;<\/a><a href=\"http:\/\/excelvbatutor.com\/index.php\/tutorial\/\"> [Contents] <\/a><a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-6-mathematical-functions\/\">&lt;&lt;Lesson 6&gt;&gt;<\/a><\/strong><\/h4>\n\n\n\n<h3 class=\"wp-block-heading\">5.1 Sub Procedure<\/h3>\n\n\n\n<p>A sub procedure in Excel VBA is a procedure that performs a specific task and to return values, but it does not return a value associated with its name. However, it can return a value through a variable name. Sub procedures are usually used to accept input from the user, display information, print information, manipulate properties or perform some other tasks. It is a program code by itself and it is not an event procedure because it is not associated with a runtime procedure or an Excel VBA control such as a command button. It is called by the main program whenever it is required to perform a certain task. A Sub procedure helps to make programs smaller and easier to manage.<br>\n<script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-3033628290023372\" data-ad-slot=\"9639157585\"><\/ins><br>\n<script><br \/>\n     (adsbygoogle = window.adsbygoogle || []).push({});<br \/>\n<\/script><br>\nA sub procedure begins with a Sub statement and ends with an End Sub statement. The program structure of a sub procedure is as follows:<\/p>\n\n\n\n<p>Sub ProcedureName (arguments)<br>\nStatements<br>\nEnd Sub<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example 5.1<\/strong><\/h4>\n\n\n\n<p>In this example, a sub procedure ResizeFont is created to resize the font in the range if it fulfils a value greater than 40. There are two parameters or arguments associated with the sub procedure, namely x for font size and Rge for range. This sub procedure is called by the event procedure Sub CommandButton1_Click () and passed the values 15 to x (for font size) and Range (\u201cA1:A10\u201d) to Rge (for range) to perform the task of resizing the font to 15 for values&gt;40 in range A1 to A10.<\/p>\n\n\n\n<p>Private Sub CommandButton1_Click()<br>\nResizeFont 15, Range(&#8220;A1:A10&#8221;)<br>\nEnd Sub<\/p>\n\n\n\n<p>Sub ResizeFont(x As Variant, Rge As Range)<br>\nDim cel As Range<br>\nFor Each cel In Rge<br>\nIf cel.Value &gt; 40 Then<br>\ncel.Font.Size = x<br>\nEnd If<br>\nNext cel<br>\nEnd Sub<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"366\" height=\"367\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg\" alt=\"vba_Figure20.1\" class=\"wp-image-561\"\/><\/a><\/figure><\/div>\n\n\n\n<p>&nbsp;<strong>Figure 5.1<\/strong><\/p>\n\n\n\n<p><script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-3033628290023372\" data-ad-slot=\"9639157585\"><\/ins><br>\n<script><br \/>\n     (adsbygoogle = window.adsbygoogle || []).push({});<br \/>\n<\/script><br>\nTo make the program more flexible and interactive, we can modify the above program to accept input from the user. The values input by the user through the input boxes will be passed on to the procedure to execute the job, as shown in Example 20.2.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example 5.2<\/strong><\/h4>\n\n\n\n<p>Private Sub CommandButton1_Click()<br>\nDim rng As String<br>\nrng = InputBox(&#8220;Input range&#8221;)<br>\nx = InputBox(&#8220;Input Font Size&#8221;)<br>\nResizeFont x, Range(rng)<br>\nEnd Sub<\/p>\n\n\n\n<p>Sub ResizeFont(x As Variant, Rge As Range)<br>\nDim cel As Range<br>\nFor Each cel In Rge<br>\nIf cel.Value &gt; 40 Then<br>\ncel.Font.Size = x<br>\nEnd If<br>\nNext cel<br>\nEnd Sub<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5.2 Functions<\/h3>\n\n\n\n<p>In Excel VBA, a function is similar to a sub procedure but the main purpose of the function is to accept a certain input from the user and return a value which is passed on to the main program to finish the execution. There are two types of functions, the built-in functions (or internal functions) and the functions created by the programmers, or simply called user-defined functions. The first built-in function is the Message Box. The message box acts as a dialog box where users can interact with the computer, it is able to perform certain actions in response to what the user clicks or selects.\n<\/p>\n\n\n\n<div id=\"mycontent\">\n<div class=\"column1\">\n<p>The syntax for a message box in Excel VBA is as follows,<\/p>\n<p><strong>message=MsgBox(Prompt, Style Value,Title)<\/strong><\/p>\n<p>The first argument, Prompt, will display the message in the message box. The Style Value determines what type of command button will appear in the message box. The Title argument will display the title of the message board while message is a variable that holds values that are returned by the MsgBox ( ) function. The values are determined by the type of buttons being clicked by the users. It has to be declared as Integer data type in the procedure or in the general declaration section. Please refer to<a href=\"http:\/\/www.vbtutor.net\/lesson10.html\">&nbsp;Lesson 10<\/a>&nbsp;of&nbsp;<a href=\"http:\/\/www.vbtutor.net\/vbtutor.html\">Visual Basic Tutorial<\/a>&nbsp;for the detail listings of the Style Value as well as the returned value.<\/p>\n<p>In this example, We created three command buttons which show different Options. We put in a few program codes in the last button which involve the use of If&#8230;Then&#8230;Elseif statements.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.vbtutor.net\/Images\/progra_jan_21_2008_vbaII_1.gif\" alt=\"\" width=\"506\" height=\"400\"><\/figure><p><\/p>\n<p><strong>Figure 5.2<\/strong>\n<\/p><p align=\"left\">Double-click the top button and enter the following code:<\/p>\n<p align=\"left\">Private Sub CommandButton1_Click()<\/p>\n<p align=\"left\">MsgBox (&#8220;Welcome to VBA Programming&#8221;)<\/p>\n<p align=\"left\">End Sub<\/p>\n<p align=\"left\">By clicking the first message box, you will see the message as shown in Figure 5.2<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.vbtutor.net\/Images\/progra_jan_21_2008_vbaII_2.gif\" alt=\"\" width=\"288\" height=\"246\"><\/figure><p align=\"left\"><\/p>\n<p align=\"left\"><strong>Figure 5.3<\/strong><\/p>\n<p align=\"left\">Now double-click on the second button and enter the following code:<\/p>\n<p align=\"left\">Private Sub CommandButton2_Click()<\/p>\n<p>Dim message As String<br>\nmessage = MsgBox(&#8220;Click Yes to Proceed, No to stop&#8221;, vbYesNoCancel, &#8220;Login&#8221;)<br>\nIf message = vbYes Then<br>\nMsgBox &#8220;You may proceed&#8221;<br>\nActiveWorkbook.Activate<br>\nElseIf message = vbNo Then<br>\nMsgBox &#8220;Your application is terminated&#8221;<br>\nActiveWorkbook.Close<br>\nEnd If<\/p>\n<p>End Sub<\/p>\n<p>Click on the button and you shall see the following dialog. You will notice the Yes, No, Cancel buttons:<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/excelvbatutor.com\/vba_img\/vba_3_1_2.gif\" alt=\"\" width=\"349\" height=\"152\"><\/figure><p><\/p>\n<p><strong>Figure 5.4<\/strong><\/p>\n<p>Now double-click on the second button and enter the following code:<\/p>\n<p>Private Sub CommandButton3_Click()<br>\nDim message As Integer<br>\nmessage = MsgBox(&#8220;Click Yes to Proceed, No to stop&#8221;, vbYesNo, &#8220;Login&#8221;)<br>\nIf message = 6 Then<br>\nRange(&#8220;A1&#8221;).Value = &#8220;You may proceed&#8221;<br>\nActiveWorkbook.Activate<br>\nElseIf message = 7 Then<br>\nActiveWorkbook.Close<br>\nEnd If<br>\nEnd Sub<\/p>\n<p>Click on the button and you would notice that the displayed message box comprises only the Yes and No button, as shown in Figure 5.4<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/www.vbtutor.net\/Images\/progra_jan_22_2008_vbaII_3.gif\" alt=\"\" width=\"328\" height=\"204\"><\/figure><p><\/p>\n<p><strong>Figure 5.4<\/strong><\/p>\n<h4>5.2.1 InputBox function<\/h4>\n<p>An InputBox( ) function displays a message box where the user can enter a value or a message in the form of text. The syntax is<\/p>\n<p><b>myMessage=InputBox(Prompt, Title, default_text, x-position, y-position)<\/b><\/p>\n<p>myMessage is a variant data type but typically it is declared as a string, which accepts the message input by the users. The arguments are explained as follows:<\/p>\n<ul>\n<li>Prompt represents the message displayed normally as a question asked.<\/li>\n<li>The title represents the title of the Input Box.<\/li>\n<li>default-text represents the default text that appears in the input field where the user can use it as his or her intended input<\/li>\n<li>x-position and y-position represents the position or the coordinate of the input box.<\/li>\n<\/ul>\n<h4><strong>Example 5.3<\/strong><\/h4>\n<p>In this example, we insert a label and a command button into the MS Excel spreadsheet. Double click on the command button and enter the Excel VBA code as follows:<\/p>\n<p>Private Sub CommandButton1_Click()<br>\nDim userMsg As String<br>\nuserMsg = InputBox(&#8220;What is your message?&#8221;, &#8220;Message Entry Form&#8221;, &#8220;Enter your messge here&#8221;, 500, 700)<br>\nIf userMsg &lt;&gt; &#8220;&#8221; Then<br>\nMsgBox( userMsg)<br>\nElse<br>\nMsgBox(&#8220;No Message&#8221;)<br>\nEnd If<br>\nEnd Sub<br>\n* The InputBox is shown in Figure 5.4\n<\/p><figure><a href=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig6.1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"373\" height=\"159\" class=\"aligncenter size-full wp-image-1128\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig6.1.jpg\" alt=\"vba2010_fig6.1\"><\/a><\/figure><p align=\"center\"><\/p>\n<p align=\"center\"><b>Figure 5.5&nbsp; InputBox<\/b><\/p>\n<h4>5.2.1 Creating User-Defined Functions<\/h4>\n<p>The syntax to create a User-Defined function is as follows:\n<\/p><p style=\"font-weight: bold;\">Public Function functionName (Arg As dataType,&#8230;) As dataType<\/p>\n<p>or\n<\/p><p style=\"font-weight: bold;\">Private Function functionName (Arg As dataType,&#8230;) As dataType<\/p>\n<p>Public indicates that the function is applicable to the whole project while Private indicates that the function is only applicable to a certain module or procedure.<\/p>\n<p>In order to create a user-defined function in Excel VBA, you need to go into the Visual Basic Editor in MS Excel Spreadsheet.In the Visual Basic Editor, click on Insert on the menu bar to insert a module into the project. Enter the following code as shown in Figure 5.2. This function is to calculate the cube root of a number.\n<\/p><figure><a href=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig6.2.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"449\" class=\"aligncenter size-full wp-image-1133\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig6.2.jpg\" alt=\"vba2010_fig6.2\"><\/a><\/figure><p align=\"center\"><\/p>\n<h4 align=\"center\">Figure 5.6<\/h4>\n<p><script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br>\n<!-- vba Lesson 5 Responsive --><br>\n<ins class=\"adsbygoogle\" style=\"display: block;\" data-ad-client=\"ca-pub-3033628290023372\" data-ad-slot=\"5467294706\" data-ad-format=\"auto\"><\/ins><br>\n<script><br \/>\n(adsbygoogle = window.adsbygoogle || []).push({});<br \/>\n<\/script><\/p>\n<p>Now enter the function CubeRoot just like you enter the formula of MS Excel, as shown in Figure 5.3. The value of cube root for the number in cell C4 will appear in cell D4.\n<\/p><figure><a href=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig6.3.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"743\" height=\"468\" class=\"aligncenter size-full wp-image-1136\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig6.3.jpg\" alt=\"vba2010_fig6.3\"><\/a><\/figure><p align=\"center\"><\/p>\n<h4 align=\"center\">Figure 5.7<\/h4>\n<p>&nbsp;<br>\n<\/p><h4 style=\"text-align: center;\"><strong><a href=\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-4-operators-in-excel-vba\/\">&lt;&lt;Lesson 4&gt;&gt;<\/a><a href=\"https:\/\/excelvbatutor.com\/index.php\/tutorial\/\">&nbsp;[Contents]&nbsp;<\/a><a href=\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-6-mathematical-functions\/\">&lt;&lt;Lesson 6&gt;&gt;<\/a><\/strong><\/h4>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&lt;&lt;Lesson 4&gt;&gt; [Contents] &lt;&lt;Lesson 6&gt;&gt; 5.1 Sub Procedure A sub procedure in Excel VBA is a procedure that performs a specific task and to return values, but it does not return a value associated with its name. However, it can return a value through a variable name. Sub procedures are usually used to accept input &hellip; <a href=\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-5-sub-procedure-functions\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Excel VBA Lesson 5: Sub Procedures and Functions&#8221;<\/span><\/a><\/p>\n","protected":false},"author":5012,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-560","page","type-page","status-publish","hentry","category-function"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Excel VBA Lesson 5: Sub Procedures and Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor<\/title>\n<meta name=\"description\" content=\"This Excel VBA article explains the concepts of sub procedures and functions in Excel VBA\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/excelvbatutor.com\/vba_lesson5.htm\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Excel VBA Lesson 5: Sub Procedures and Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\" \/>\n<meta property=\"og:description\" content=\"This Excel VBA article explains the concepts of sub procedures and functions in Excel VBA\" \/>\n<meta property=\"og:url\" content=\"https:\/\/excelvbatutor.com\/vba_lesson5.htm\" \/>\n<meta property=\"og:site_name\" content=\"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-23T11:00:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"366\" \/>\n\t<meta property=\"og:image:height\" content=\"367\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-5-sub-procedure-functions\/\",\"url\":\"https:\/\/excelvbatutor.com\/vba_lesson5.htm\",\"name\":\"Excel VBA Lesson 5: Sub Procedures and Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\",\"isPartOf\":{\"@id\":\"https:\/\/excelvbatutor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson5.htm#primaryimage\"},\"image\":{\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson5.htm#primaryimage\"},\"thumbnailUrl\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg\",\"datePublished\":\"2013-03-03T15:16:03+00:00\",\"dateModified\":\"2020-04-23T11:00:59+00:00\",\"description\":\"This Excel VBA article explains the concepts of sub procedures and functions in Excel VBA\",\"breadcrumb\":{\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson5.htm#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/excelvbatutor.com\/vba_lesson5.htm\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson5.htm#primaryimage\",\"url\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg\",\"contentUrl\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg\",\"width\":366,\"height\":367},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson5.htm#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/excelvbatutor.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel VBA Lesson 5: Sub Procedures and Functions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/excelvbatutor.com\/#website\",\"url\":\"https:\/\/excelvbatutor.com\/\",\"name\":\"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\",\"description\":\"Master Excel VBA with free tutorials, examples, and personalized guidance. Perfect for beginners and advanced users looking to automate Excel.\",\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Excel VBA Lesson 5: Sub Procedures and Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","description":"This Excel VBA article explains the concepts of sub procedures and functions in Excel VBA","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:\/\/excelvbatutor.com\/vba_lesson5.htm","og_locale":"en_US","og_type":"article","og_title":"Excel VBA Lesson 5: Sub Procedures and Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","og_description":"This Excel VBA article explains the concepts of sub procedures and functions in Excel VBA","og_url":"https:\/\/excelvbatutor.com\/vba_lesson5.htm","og_site_name":"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","article_modified_time":"2020-04-23T11:00:59+00:00","og_image":[{"width":366,"height":367,"url":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg","type":"image\/jpeg"}],"twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-5-sub-procedure-functions\/","url":"https:\/\/excelvbatutor.com\/vba_lesson5.htm","name":"Excel VBA Lesson 5: Sub Procedures and Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","isPartOf":{"@id":"https:\/\/excelvbatutor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/excelvbatutor.com\/vba_lesson5.htm#primaryimage"},"image":{"@id":"https:\/\/excelvbatutor.com\/vba_lesson5.htm#primaryimage"},"thumbnailUrl":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg","datePublished":"2013-03-03T15:16:03+00:00","dateModified":"2020-04-23T11:00:59+00:00","description":"This Excel VBA article explains the concepts of sub procedures and functions in Excel VBA","breadcrumb":{"@id":"https:\/\/excelvbatutor.com\/vba_lesson5.htm#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/excelvbatutor.com\/vba_lesson5.htm"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/excelvbatutor.com\/vba_lesson5.htm#primaryimage","url":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg","contentUrl":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_Figure20.1.jpg","width":366,"height":367},{"@type":"BreadcrumbList","@id":"https:\/\/excelvbatutor.com\/vba_lesson5.htm#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/excelvbatutor.com\/"},{"@type":"ListItem","position":2,"name":"Excel VBA Lesson 5: Sub Procedures and Functions"}]},{"@type":"WebSite","@id":"https:\/\/excelvbatutor.com\/#website","url":"https:\/\/excelvbatutor.com\/","name":"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","description":"Master Excel VBA with free tutorials, examples, and personalized guidance. Perfect for beginners and advanced users looking to automate Excel.","inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/users\/5012"}],"replies":[{"embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/comments?post=560"}],"version-history":[{"count":39,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/560\/revisions"}],"predecessor-version":[{"id":3473,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/560\/revisions\/3473"}],"wp:attachment":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/media?parent=560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/categories?post=560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/tags?post=560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}