{"id":121,"date":"2015-10-24T12:13:40","date_gmt":"2015-10-24T12:13:40","guid":{"rendered":"http:\/\/99excel.com\/?p=121"},"modified":"2021-05-14T16:09:21","modified_gmt":"2021-05-14T16:09:21","slug":"looping-through-code","status":"publish","type":"post","link":"https:\/\/99excel.com\/home\/looping-through-code\/","title":{"rendered":"Looping Through Code"},"content":{"rendered":"<p><strong>U<\/strong>sing conditional statements and looping statements (also called control structures), you can write Visual Basic code that makes decisions and repeats actions. Another useful control structure, the <strong>WITH<\/strong> statement, lets you to run a series of statements without having to re-qualify an object.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Using Conditional Statements to Make Decisions<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Conditional statements evaluate whether a condition is <strong>TRUE<\/strong> or <strong>FALSE<\/strong>, and then specify one or more statements to run, depending on the result. Usually, a condition is an expression that uses a comparison operator to compare one value or variable with another.<\/p>\n<p>&nbsp;<\/p>\n<p><strong><u>Choosing a Conditional Statement to Use<\/u><\/strong><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong>..Then&#8230;Else:<\/strong> Branching when a condition is True or False<\/li>\n<li><strong>Select Case:<\/strong> Selecting a branch from a set of conditions<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong><u>Using Loops to Repeat Code<\/u><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Looping allows you to run a group of statements repeatedly. Some loops repeat statements until a condition is <strong>FALSE<\/strong>; others repeat statements until a condition is <strong>TRUE<\/strong>. There are also loops that repeat statements a specific number of times or for each object in a collection.<\/p>\n<p>&nbsp;<\/p>\n<p>Choosing a Loop to Use<\/p>\n<ul>\n<li><strong>..Loop:<\/strong> Looping while or until a condition is <strong>TRUE <\/strong><\/li>\n<li><strong>..Next:<\/strong> Using a counter to run statements a specified number of times<\/li>\n<li><strong>For Each&#8230;Next:<\/strong> Repeating a group of statements for each object in a collection<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong><u>Running Several Statements on the Same Object<\/u><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>In Visual Basic, usually you must specify an object before you can run one of its methods or change one of its properties. You can use the <strong>WITH<\/strong> statement to specify an object once for an entire series of statements.<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong>With:<\/strong> Running a series of statements on the same object<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Using conditional statements and looping statements (also called control structures), you can write Visual Basic code that makes decisions and repeats actions. Another useful control structure, the WITH statement, lets you to run a series of statements without having to re-qualify an object. &nbsp; &nbsp; Using Conditional Statements to Make Decisions &nbsp; Conditional statements evaluate &#8230; <a title=\"Looping Through Code\" class=\"read-more\" href=\"https:\/\/99excel.com\/home\/looping-through-code\/\" aria-label=\"More on Looping Through Code\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/comments?post=121"}],"version-history":[{"count":1,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":896,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/posts\/121\/revisions\/896"}],"wp:attachment":[{"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/media?parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/categories?post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/99excel.com\/home\/wp-json\/wp\/v2\/tags?post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}