{"id":1458,"date":"2013-12-13T01:39:12","date_gmt":"2013-12-13T01:39:12","guid":{"rendered":"http:\/\/excelvbatutor.com\/?page_id=1458"},"modified":"2019-04-19T07:53:04","modified_gmt":"2019-04-19T07:53:04","slug":"excel-vba-2010-lesson-22-working-with-check-box-and-option-button","status":"publish","type":"page","link":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/","title":{"rendered":"Excel 2010 VBA Lesson 22: The CheckBox and Option Button"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">&nbsp;<strong><a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-21-formatting-font-and-background-colors\/\">[Lesson 21]<\/a>&lt;&lt;<a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-tutorial\/\">[Table of Contents]<\/a>&gt;&gt;<a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-201-lesson-23-working-with-list-box-combo-box-and-toggle-button\/\">[Lesson 23]<\/a><\/strong><\/h4>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>22.1 The CheckBox <\/strong><\/h4>\n\n\n\n<p>The Checkbox and option button allows the user to select one or more items by checking the check box or check boxes concerned. For example, you may create a shopping cart where the user can click on checkboxes that correspond to the items they intend to buy can calculate the total payment. <\/p>\n\n\n\n<script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\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>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p>One of the most important properties of the checkbox in Excel 2010 VBA &nbsp;is Value. If the checkbox is selected or checked, the value is true, whilst if it is not selected or unchecked, the Value is False.<\/p>\n\n\n\n<p><script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br><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><script><br \/>\n     (adsbygoogle = window.adsbygoogle || []).push({});<br \/>\n<\/script><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example 22.1<\/strong><\/h4>\n\n\n\n<p>In this example, the user can choose to display the sale volume of one type of fruits sold or total sale volume. The code is shown below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Private Sub CommandButton1_Click()\nIf CheckBox1.Value = True And CheckBox2.Value = False Then\n MsgBox \u201cQuantity of apple sold is\u201d &amp; Cells (2, 2).Value\nElseIf CheckBox2.Value = True And CheckBox1.Value = False Then\n MsgBox \u201cQuantity of orange sold is \u201d &amp; Cells(2, 3).Value\nElse\n MsgBox \u201cQuantity of Fruits sold is\u201d &amp; Cells (2, 4).Value\nEnd If\nEnd Sub\n<\/pre>\n\n\n\n<p>The output Interface is shown in Figure 22.1<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"411\" height=\"501\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg\" alt=\"vba2010_figure22.1\" class=\"wp-image-1459\"\/><\/a><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Figure 22.1<\/h4>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>22.2 Option Button<\/strong><\/h4>\n\n\n\n<p>The option button control also lets the user selects one of the choices. However, two or more option buttons must work together because as one of the option buttons is selected, the other option button will be deselected. In fact, only one option button can be selected at one time. When an option button is selected, its value is set to \u201cTrue\u201d and when it is deselected; its value is set to \u201cFalse\u201d.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example 22.2<\/strong><\/h4>\n\n\n\n<p>This example demonstrates the usage of the option buttons. In this example, the Message box will display which option button selected by the user. The output interface is shown in Figure 22.2.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">The code<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">Private Sub CommandButton1_Click()\nIf OptionButton1.Value = True Then\n MsgBox \"Option1 is selected\"\nElseIf OptionButton2.Value = True Then\n MsgBox \"Option2 is selected\"\nElse\n MsgBox \"Option3 is selected\"\nEnd If\nEnd Sub\n<\/pre>\n\n\n\n<p>The output<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure-22.2.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"531\" height=\"525\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure-22.2.jpg\" alt=\"vba2010_figure 22.2\" class=\"wp-image-1466\"\/><\/a><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Figure 22.2<\/h4>\n\n\n\n<p><script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br><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><script><br \/>\n     (adsbygoogle = window.adsbygoogle || []).push({});<br \/>\n<\/script><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">&nbsp;<strong><a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-21-formatting-font-and-background-colors\/\">[Lesson 21]<\/a>&lt;&lt;<a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-tutorial\/\">[Table of Contents]<\/a>&gt;&gt;<a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-201-lesson-23-working-with-list-box-combo-box-and-toggle-button\/\">[Lesson 23]<\/a><\/strong><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;[Lesson 21]&lt;&lt;[Table of Contents]&gt;&gt;[Lesson 23] 22.1 The CheckBox The Checkbox and option button allows the user to select one or more items by checking the check box or check boxes concerned. For example, you may create a shopping cart where the user can click on checkboxes that correspond to the items they intend to buy &hellip; <a href=\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Excel 2010 VBA Lesson 22: The CheckBox and Option Button&#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":[15],"tags":[],"class_list":["post-1458","page","type-page","status-publish","hentry","category-buttons-and-boxes"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Excel 2010 VBA Lesson 22: The CheckBox and Option Button - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor<\/title>\n<meta name=\"description\" content=\"This lesson explains how to work with the checkbox and option button in excel 2010 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\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Excel 2010 VBA Lesson 22: The CheckBox and Option Button - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\" \/>\n<meta property=\"og:description\" content=\"This lesson explains how to work with the checkbox and option button in excel 2010 VBA\" \/>\n<meta property=\"og:url\" content=\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/\" \/>\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=\"2019-04-19T07:53:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"411\" \/>\n\t<meta property=\"og:image:height\" content=\"501\" \/>\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=\"2 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-2010-lesson-22-working-with-check-box-and-option-button\/\",\"url\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/\",\"name\":\"Excel 2010 VBA Lesson 22: The CheckBox and Option Button - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\",\"isPartOf\":{\"@id\":\"https:\/\/excelvbatutor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg\",\"datePublished\":\"2013-12-13T01:39:12+00:00\",\"dateModified\":\"2019-04-19T07:53:04+00:00\",\"description\":\"This lesson explains how to work with the checkbox and option button in excel 2010 VBA\",\"breadcrumb\":{\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#primaryimage\",\"url\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg\",\"contentUrl\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg\",\"width\":411,\"height\":501},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/excelvbatutor.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel 2010 VBA Lesson 22: The CheckBox and Option Button\"}]},{\"@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 2010 VBA Lesson 22: The CheckBox and Option Button - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","description":"This lesson explains how to work with the checkbox and option button in excel 2010 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\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/","og_locale":"en_US","og_type":"article","og_title":"Excel 2010 VBA Lesson 22: The CheckBox and Option Button - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","og_description":"This lesson explains how to work with the checkbox and option button in excel 2010 VBA","og_url":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/","og_site_name":"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","article_modified_time":"2019-04-19T07:53:04+00:00","og_image":[{"width":411,"height":501,"url":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg","type":"image\/jpeg"}],"twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/","url":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/","name":"Excel 2010 VBA Lesson 22: The CheckBox and Option Button - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","isPartOf":{"@id":"https:\/\/excelvbatutor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#primaryimage"},"image":{"@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#primaryimage"},"thumbnailUrl":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg","datePublished":"2013-12-13T01:39:12+00:00","dateModified":"2019-04-19T07:53:04+00:00","description":"This lesson explains how to work with the checkbox and option button in excel 2010 VBA","breadcrumb":{"@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#primaryimage","url":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg","contentUrl":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_figure22.1.jpg","width":411,"height":501},{"@type":"BreadcrumbList","@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-22-working-with-check-box-and-option-button\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/excelvbatutor.com\/"},{"@type":"ListItem","position":2,"name":"Excel 2010 VBA Lesson 22: The CheckBox and Option Button"}]},{"@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\/1458","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=1458"}],"version-history":[{"count":53,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/1458\/revisions"}],"predecessor-version":[{"id":3331,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/1458\/revisions\/3331"}],"wp:attachment":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/media?parent=1458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/categories?post=1458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/tags?post=1458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}