{"id":450,"date":"2013-03-03T04:13:12","date_gmt":"2013-03-03T04:13:12","guid":{"rendered":"http:\/\/excelvbatutor.com\/?page_id=450"},"modified":"2020-04-23T10:55:37","modified_gmt":"2020-04-23T10:55:37","slug":"excel-vba-lesson-17-part-1-excel-vba-object","status":"publish","type":"page","link":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-17-part-1-excel-vba-object\/","title":{"rendered":"Excel VBA Lesson 17 : Introduction to Excel VBA Objects Part 1"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\"><strong><a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-16-formatting-font-colors\/\">&lt;&lt;Lesson 16&gt;&gt;<\/a> <a href=\"http:\/\/excelvbatutor.com\/index.php\/tutorial\/\">[Contents]<\/a> <a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-18-excel-vba-objects\/\">&lt;&lt;Lesson 18&gt;&gt;<\/a><\/strong><\/h4>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>17.1 The Concept of Object in Excel VBA<\/strong><\/h3>\n\n\n\n<p>Most programming languages today deal with objects, a concept called object-oriented programming. Although Excel VBA is not a true object-oriented programming language, it does deal with objects. Excel VBA object is something like a tool or a thing that has certain functions and properties and can contain data. For example, an Excel Worksheet is an object, the cell in a worksheet is an object, the range of cells is an object, font of a cell is an object, a command button is an object, and a text box is an object and more.In order to view the ExcelVBA objects, click object browser in the Excel VBA IDE and you will be presented with a list of objects(or classes) together with their properties and methods, as shown in Figure 17.1.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"576\" height=\"429\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg\" alt=\"Excel VBA\" class=\"wp-image-451\"\/><\/a><\/figure><\/div>\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>\n<\/p>\n\n\n\n<p><strong>Figure 17.1<\/strong><\/p>\n\n\n\n<p>If you have inserted some Active-X controls into the worksheet, clicking on the relevant worksheet will reveal the objects together with the associated events, as shown in Figure 17.2<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/excelvbatutor.com\/vba_img\/vba_objects.gif\" alt=\"Excel VBA\"\/><\/figure>\n\n\n\n<p><strong>Figure 17.2<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>17.2: Object Properties<\/strong><\/h3>\n\n\n\n<p>An Excel VBA object has properties and methods. Properties are the characteristics or attributes of an object. For example, Range is an Excel VBA object and one of its properties is value. We connect an object to its property by a period(a dot or full stop). The following example shows how we connect the property value to the Range object.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example 17.1<\/strong><\/h4>\n\n\n\n<p>Private Sub CommandButton1_Click()<br>\nRange(&#8220;A1:A6&#8221;).Value = 10<br>\nEnd Sub<\/p>\n\n\n\n<p>* Since value is the default property, it can be omitted and the above code can be rewritten as<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example 17.2<\/strong><\/h4>\n\n\n\n<p>Private Sub CommandButton1_Click()<br>\nRange(&#8220;A1:A6&#8221;)= 10<br>\nEnd Sub<\/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><\/p>\n\n\n\n<p>The Cells is also an Excel VBA object, but it is also the property of the range object. So an object can also be a property, it depends on the hierarchy of the objects. Range has higher hierarchy than cells, and interior has lower hierarchy than Cells, and color has lower hierarchy than Interior, so you can write<\/p>\n\n\n\n<p>Range(&#8220;A1:A3&#8221;).Cells(1, 1).Interior.Color = vbYellow<\/p>\n\n\n\n<p>This statement will fill cells (1,1) with yellow color. Notice that although the Range object specifies a range from A1 to A3, the cells property specifies only cells(1,1) to be filled with yellow color, it sorts of overwriting the range specified by the Range object.<\/p>\n\n\n\n<p>Another object is the font that belongs to the Range object. And font has its properties.For example, Range(\u201cA1:A4\u201d).Font.Color=vbYellow, the color property of the object Font will result in all the contents from cell A1 to cell A4 to be filled in yellow color.<\/p>\n\n\n\n<p>Sometimes it is not necessary to type the properties, Excel VBA IntelliSense will display a drop-down list of proposed properties after you type a period at the end of the object name. You can then select the property you want by double-clicking it or by highlighting it then press the Enter key. The IntelliSense drop-down is shown in Figure 17.3<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/excelvbatutor.com\/vba_img\/vba_Intellisense.gif\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>Figure 17.3<\/strong><\/p>\n\n\n\n<p>We shall discuss object methods in the next lesson<br>\n<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong><a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-16-formatting-font-colors\/\">&lt;&lt;Lesson 16&gt;&gt;<\/a> <a href=\"http:\/\/excelvbatutor.com\/index.php\/tutorial\/\">[Contents]<\/a> <a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-18-excel-vba-objects\/\">&lt;&lt;Lesson 18&gt;&gt;<\/a><\/strong><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>&lt;&lt;Lesson 16&gt;&gt; [Contents] &lt;&lt;Lesson 18&gt;&gt; 17.1 The Concept of Object in Excel VBA Most programming languages today deal with objects, a concept called object-oriented programming. Although Excel VBA is not a true object-oriented programming language, it does deal with objects. Excel VBA object is something like a tool or a thing that has certain functions &hellip; <a href=\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-17-part-1-excel-vba-object\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Excel VBA Lesson 17 : Introduction to Excel VBA Objects Part 1&#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":[10],"tags":[],"class_list":["post-450","page","type-page","status-publish","hentry","category-object"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Understanding the concept of Object in Excel VBA macro programming<\/title>\n<meta name=\"description\" content=\"This Excel VBA lesson explains the concept of objects in Excel VBA macro in details as well as object-oriented programming\" \/>\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_lesson17.htm\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding the concept of Object in Excel VBA macro programming\" \/>\n<meta property=\"og:description\" content=\"This Excel VBA lesson explains the concept of objects in Excel VBA macro in details as well as object-oriented programming\" \/>\n<meta property=\"og:url\" content=\"https:\/\/excelvbatutor.com\/vba_lesson17.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-23T10:55:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"576\" \/>\n\t<meta property=\"og:image:height\" content=\"429\" \/>\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=\"3 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-17-part-1-excel-vba-object\/\",\"url\":\"https:\/\/excelvbatutor.com\/vba_lesson17.htm\",\"name\":\"Understanding the concept of Object in Excel VBA macro programming\",\"isPartOf\":{\"@id\":\"https:\/\/excelvbatutor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson17.htm#primaryimage\"},\"image\":{\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson17.htm#primaryimage\"},\"thumbnailUrl\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg\",\"datePublished\":\"2013-03-03T04:13:12+00:00\",\"dateModified\":\"2020-04-23T10:55:37+00:00\",\"description\":\"This Excel VBA lesson explains the concept of objects in Excel VBA macro in details as well as object-oriented programming\",\"breadcrumb\":{\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson17.htm#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/excelvbatutor.com\/vba_lesson17.htm\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson17.htm#primaryimage\",\"url\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg\",\"contentUrl\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg\",\"width\":576,\"height\":429},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/excelvbatutor.com\/vba_lesson17.htm#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/excelvbatutor.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel VBA Lesson 17 : Introduction to Excel VBA Objects Part 1\"}]},{\"@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":"Understanding the concept of Object in Excel VBA macro programming","description":"This Excel VBA lesson explains the concept of objects in Excel VBA macro in details as well as object-oriented programming","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_lesson17.htm","og_locale":"en_US","og_type":"article","og_title":"Understanding the concept of Object in Excel VBA macro programming","og_description":"This Excel VBA lesson explains the concept of objects in Excel VBA macro in details as well as object-oriented programming","og_url":"https:\/\/excelvbatutor.com\/vba_lesson17.htm","og_site_name":"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","article_modified_time":"2020-04-23T10:55:37+00:00","og_image":[{"width":576,"height":429,"url":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg","type":"image\/jpeg"}],"twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-lesson-17-part-1-excel-vba-object\/","url":"https:\/\/excelvbatutor.com\/vba_lesson17.htm","name":"Understanding the concept of Object in Excel VBA macro programming","isPartOf":{"@id":"https:\/\/excelvbatutor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/excelvbatutor.com\/vba_lesson17.htm#primaryimage"},"image":{"@id":"https:\/\/excelvbatutor.com\/vba_lesson17.htm#primaryimage"},"thumbnailUrl":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg","datePublished":"2013-03-03T04:13:12+00:00","dateModified":"2020-04-23T10:55:37+00:00","description":"This Excel VBA lesson explains the concept of objects in Excel VBA macro in details as well as object-oriented programming","breadcrumb":{"@id":"https:\/\/excelvbatutor.com\/vba_lesson17.htm#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/excelvbatutor.com\/vba_lesson17.htm"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/excelvbatutor.com\/vba_lesson17.htm#primaryimage","url":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg","contentUrl":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/03\/vba_figure13.1.jpg","width":576,"height":429},{"@type":"BreadcrumbList","@id":"https:\/\/excelvbatutor.com\/vba_lesson17.htm#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/excelvbatutor.com\/"},{"@type":"ListItem","position":2,"name":"Excel VBA Lesson 17 : Introduction to Excel VBA Objects Part 1"}]},{"@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\/450","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=450"}],"version-history":[{"count":32,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/450\/revisions"}],"predecessor-version":[{"id":3461,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/450\/revisions\/3461"}],"wp:attachment":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/media?parent=450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/categories?post=450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/tags?post=450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}