{"id":6205,"date":"2017-07-02T07:02:39","date_gmt":"2017-07-02T07:02:39","guid":{"rendered":"https:\/\/wordherd.io\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/"},"modified":"2017-07-02T07:02:39","modified_gmt":"2017-07-02T07:02:39","slug":"why-the-set-command-is-so-important-in-learning-vba-for-excel","status":"publish","type":"post","link":"https:\/\/wordherd.io\/fr\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/","title":{"rendered":"Why The Set Command Is So Important In Learning VBA For Excel"},"content":{"rendered":"<p>VBA instructions and properties will be difficult, particularly once you&#8217;re beginning out growing Excel purposes. Luckily, the VBA language is kind of intuitive and you may apply some frequent sense to get your code working correctly.<\/p>\n<p>Utilizing the <em>set<\/em> command permits VBA to present you entry to the properties of alternatives and ranges, making coding that a lot simpler.<\/p>\n<p><strong>How To Use The Set Command<\/strong><\/p>\n<p>One state of affairs is likely to be to entry a column from an information desk:<br \/>\n<\/p>\n<pre>\n<br>Names Gross sales\n<br>John 98\n<br>Maria 122\n<br>Henri 120\n<br>Mary 102\n<br>Peter 85\n<br>Jacques 130\n<br>Mary 100\n<br><\/pre>\n<\/p>\n<p>If you happen to use the present area command to pick out the primary column and print to the<br \/>\n<br \/>fast window, the code would possibly appear to be this:<\/p>\n<p><pre> \n<br>Vary(\"a1\").CurrentRegion.Choose\n<br>For Every c In Choice.Rows\n<br>Debug.Print c.Columns(1)\n<br>Subsequent\n<br><\/pre>\n<\/p>\n<p>The one downside utilizing this technique is that VBA would not provide you with any assist. For instance you may get a rely of the variety of rows with this command:<\/p>\n<p><pre>\n<br>noRows=choice.rows.rely\n<br><\/pre>\n<p>That appears effective, however it&#8217;s essential to know the <em>row rely<\/em> command within the first place. VBA may also help with this in case you do issues barely in a different way and outline the choice as a spread first.<br \/>\n<\/p>\n<pre>\n<br>Dim mySel As Vary\n<br>Set mySel = Vary(\"a1\").CurrentRegion\n<br><\/pre>\n<\/p>\n<p>With the choice outlined, VBA provides some assist in accessing the properties of the<br \/>\n<br \/>vary. To entry the properties on this case you possibly can sort <em>mySel.<\/em> and you might be provided the selection of over 20 totally different properties.<\/p>\n<p>To get the variety of rows, you would choose the rows choice, after which the rely property. On this means, you should use frequent sense and experimentation to get the consequence you want.<\/p>\n<p><pre>\n<br>noRows=mySel.rows.rely\n<br><\/pre>\n<\/p>\n<p><strong>Utilizing The Set Command To Code A Worksheet Perform<\/strong><\/p>\n<p>We&#8217;ll use the set command on this instance to learn the way many cells comprise the title &#8220;Mary&#8221;.<\/p>\n<p>With out the set command we would write one thing like this:<br \/>\n<\/p>\n<pre>\n<br>myStr=\"Mary\"\n<br>countStr = Utility.WorksheetFunction.CountIf(vary(\"a1:a8\"), myStr)\n<br><\/pre>\n<\/p>\n<p>We will additionally apply the set command to worksheet features and this makes writing the process that a lot simpler.<br \/>\n<\/p>\n<pre>\n<br>dim mySel as vary\n<br>set mySel = Vary(\"a1\").CurrentRegion\n<br>Dim func As WorksheetFunction\n<br>Set func = Utility.WorksheetFunction\n<br>myStr=\"Mary\"\n<br><\/pre>\n<p>The ensuing code is straightforward and simple to learn, particularly if it&#8217;s essential to use the operate once more later within the process.<br \/>\n<\/p>\n<pre>\n<br>countStr= func.CountIf(mySel, \"Mary\")\n<br><\/pre>\n<p>It is helpful to notice that utilizing the set command could make your code run barely slower. However in conditions the place you are unsure in regards to the appropriate coding, it will possibly make your procedures simpler to write down and is a worthwhile trade-off.<\/p>\n<p><strong>Abstract<\/strong><\/p>\n<p>Utilizing the set command is a good suggestion when writing any code, particularly in case you&#8217;re uncertain as to the right means of accessing the properties of a range. One of many targets when utilizing VBA is to speak your concepts in a transparent and simple method and the set command helps you try this.<\/p>\n<div class=\"source\"><a href=\"http:\/\/ezinearticles.com\/?Why-The-Set-Command-Is-So-Important-In-Learning-VBA-For-Excel&#038;id=7388365\">Source<\/a> par <a href=\"http:\/\/ezinearticles.com\/expert\/Andy_L_Gibson\/1382722\">Andy L Gibson<\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>VBA instructions and properties will be difficult, particularly once you&#8217;re beginning out growing Excel purposes. Luckily, the VBA language is kind of intuitive and you may apply some frequent sense to get your code working correctly. Utilizing the set command permits VBA to present you entry to the properties of alternatives and ranges, making coding [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","inline_featured_image":false,"footnotes":""},"categories":[15],"tags":[200,595],"builders":[],"industry":[],"platform":[],"class_list":["post-6205","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-wordpress","tag-wordpress-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Why The Set Command Is So Important In Learning VBA For Excel - WordHerd WordPress Migration<\/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:\/\/wordherd.io\/fr\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Why The Set Command Is So Important In Learning VBA For Excel - WordHerd WordPress Migration\" \/>\n<meta property=\"og:description\" content=\"VBA instructions and properties will be difficult, particularly once you&#8217;re beginning out growing Excel purposes. Luckily, the VBA language is kind of intuitive and you may apply some frequent sense to get your code working correctly. Utilizing the set command permits VBA to present you entry to the properties of alternatives and ranges, making coding [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wordherd.io\/fr\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/\" \/>\n<meta property=\"og:site_name\" content=\"WordHerd WordPress Migration\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/wordherdio\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-02T07:02:39+00:00\" \/>\n<meta name=\"author\" content=\"WordHerd\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@wordherdio\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"WordHerd\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/why-the-set-command-is-so-important-in-learning-vba-for-excel\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/why-the-set-command-is-so-important-in-learning-vba-for-excel\\\/\"},\"author\":{\"name\":\"WordHerd\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#\\\/schema\\\/person\\\/373419b97c0fbc45a3a16462bdba0fac\"},\"headline\":\"Why The Set Command Is So Important In Learning VBA For Excel\",\"datePublished\":\"2017-07-02T07:02:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/why-the-set-command-is-so-important-in-learning-vba-for-excel\\\/\"},\"wordCount\":459,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/#organization\"},\"keywords\":[\"WordPress\",\"wordpress tutorial\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wordherd.io\\\/blog\\\/why-the-set-command-is-so-important-in-learning-vba-for-excel\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/why-the-set-command-is-so-important-in-learning-vba-for-excel\\\/\",\"url\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/why-the-set-command-is-so-important-in-learning-vba-for-excel\\\/\",\"name\":\"Why The Set Command Is So Important In Learning VBA For Excel - WordHerd WordPress Migration\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/#website\"},\"datePublished\":\"2017-07-02T07:02:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/why-the-set-command-is-so-important-in-learning-vba-for-excel\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wordherd.io\\\/blog\\\/why-the-set-command-is-so-important-in-learning-vba-for-excel\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/blog\\\/why-the-set-command-is-so-important-in-learning-vba-for-excel\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wordherd.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Why The Set Command Is So Important In Learning VBA For Excel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#website\",\"url\":\"https:\\\/\\\/wordherd.io\\\/\",\"name\":\"WordHerd WordPress Migration\",\"description\":\"Website Migration Services\",\"publisher\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wordherd.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#organization\",\"name\":\"WordHerd WordPress Migration\",\"url\":\"https:\\\/\\\/wordherd.io\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wordherd.io\\\/wp-content\\\/uploads\\\/wordherd-trademark.png\",\"contentUrl\":\"https:\\\/\\\/wordherd.io\\\/wp-content\\\/uploads\\\/wordherd-trademark.png\",\"width\":1000,\"height\":315,\"caption\":\"WordHerd WordPress Migration\"},\"image\":{\"@id\":\"https:\\\/\\\/wordherd.io\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/wordherd.io\\\/#\\\/schema\\\/person\\\/373419b97c0fbc45a3a16462bdba0fac\",\"name\":\"WordHerd\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g\",\"caption\":\"WordHerd\"},\"sameAs\":[\"https:\\\/\\\/wordherd.io\",\"https:\\\/\\\/www.facebook.com\\\/wordherdio\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wordherd\",\"https:\\\/\\\/x.com\\\/wordherdio\"],\"url\":\"https:\\\/\\\/wordherd.io\\\/fr\\\/blog\\\/author\\\/wordherd\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Why The Set Command Is So Important In Learning VBA For Excel - WordHerd WordPress Migration","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:\/\/wordherd.io\/fr\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/","og_locale":"fr_FR","og_type":"article","og_title":"Why The Set Command Is So Important In Learning VBA For Excel - WordHerd WordPress Migration","og_description":"VBA instructions and properties will be difficult, particularly once you&#8217;re beginning out growing Excel purposes. Luckily, the VBA language is kind of intuitive and you may apply some frequent sense to get your code working correctly. Utilizing the set command permits VBA to present you entry to the properties of alternatives and ranges, making coding [&hellip;]","og_url":"https:\/\/wordherd.io\/fr\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/","og_site_name":"WordHerd WordPress Migration","article_author":"https:\/\/www.facebook.com\/wordherdio\/","article_published_time":"2017-07-02T07:02:39+00:00","author":"WordHerd","twitter_card":"summary_large_image","twitter_creator":"@wordherdio","twitter_misc":{"\u00c9crit par":"WordHerd","Dur\u00e9e de lecture estim\u00e9e":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wordherd.io\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/#article","isPartOf":{"@id":"https:\/\/wordherd.io\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/"},"author":{"name":"WordHerd","@id":"https:\/\/wordherd.io\/#\/schema\/person\/373419b97c0fbc45a3a16462bdba0fac"},"headline":"Why The Set Command Is So Important In Learning VBA For Excel","datePublished":"2017-07-02T07:02:39+00:00","mainEntityOfPage":{"@id":"https:\/\/wordherd.io\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/"},"wordCount":459,"commentCount":0,"publisher":{"@id":"https:\/\/wordherd.io\/#organization"},"keywords":["WordPress","wordpress tutorial"],"articleSection":["WordPress"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wordherd.io\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wordherd.io\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/","url":"https:\/\/wordherd.io\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/","name":"Why The Set Command Is So Important In Learning VBA For Excel - WordHerd WordPress Migration","isPartOf":{"@id":"https:\/\/wordherd.io\/#website"},"datePublished":"2017-07-02T07:02:39+00:00","breadcrumb":{"@id":"https:\/\/wordherd.io\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wordherd.io\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wordherd.io\/blog\/why-the-set-command-is-so-important-in-learning-vba-for-excel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wordherd.io\/"},{"@type":"ListItem","position":2,"name":"Why The Set Command Is So Important In Learning VBA For Excel"}]},{"@type":"WebSite","@id":"https:\/\/wordherd.io\/#website","url":"https:\/\/wordherd.io\/","name":"Migration de WordHerd vers WordPress","description":"Services de migration de sites web","publisher":{"@id":"https:\/\/wordherd.io\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wordherd.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/wordherd.io\/#organization","name":"Migration de WordHerd vers WordPress","url":"https:\/\/wordherd.io\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/wordherd.io\/#\/schema\/logo\/image\/","url":"https:\/\/wordherd.io\/wp-content\/uploads\/wordherd-trademark.png","contentUrl":"https:\/\/wordherd.io\/wp-content\/uploads\/wordherd-trademark.png","width":1000,"height":315,"caption":"WordHerd WordPress Migration"},"image":{"@id":"https:\/\/wordherd.io\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/wordherd.io\/#\/schema\/person\/373419b97c0fbc45a3a16462bdba0fac","name":"WordHerd","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bf8c7166601a64c6c57b67ffbeab8f8c6a378cca786da9a326c1a34a2ec6f860?s=96&d=mm&r=g","caption":"WordHerd"},"sameAs":["https:\/\/wordherd.io","https:\/\/www.facebook.com\/wordherdio\/","https:\/\/www.linkedin.com\/company\/wordherd","https:\/\/x.com\/wordherdio"],"url":"https:\/\/wordherd.io\/fr\/blog\/author\/wordherd\/"}]}},"_links":{"self":[{"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/posts\/6205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/comments?post=6205"}],"version-history":[{"count":0,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/posts\/6205\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/media?parent=6205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/categories?post=6205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/tags?post=6205"},{"taxonomy":"builders","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/builders?post=6205"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/industry?post=6205"},{"taxonomy":"platform","embeddable":true,"href":"https:\/\/wordherd.io\/fr\/wp-json\/wp\/v2\/platform?post=6205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}