{"id":3631,"date":"2023-09-29T01:41:24","date_gmt":"2023-09-29T01:41:24","guid":{"rendered":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/"},"modified":"2023-12-03T13:05:54","modified_gmt":"2023-12-03T13:05:54","slug":"geh-raus-wenn","status":"publish","type":"page","link":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/","title":{"rendered":"Wie verwende ich die if-anweisung in vba?"},"content":{"rendered":"<div class=\"excel-vor-dem-inhalt\" id=\"excel-3357201229\"><script type=\"text\/javascript\">\r\n\tatOptions = {\r\n\t\t'key' : 'c1158f160081d6540a8409e6925dab94',\r\n\t\t'format' : 'iframe',\r\n\t\t'height' : 250,\r\n\t\t'width' : 300,\r\n\t\t'params' : {}\r\n\t};\r\n<\/script>\r\n<script type=\"text\/javascript\" src=\"\/\/www.highperformanceformat.com\/c1158f160081d6540a8409e6925dab94\/invoke.js\"><\/script><\/div> <p>Wenn Sie in VBA die <a href=\"https:\/\/exceladvisor.org\/de\/wenn-2\/\">IF-Anweisung<\/a> verwenden, k\u00f6nnen Sie eine GoTo-Anweisung verwenden, um das IF zu verlassen. Lassen Sie mich das hier klarstellen. Es gibt keine separate Exit-Anweisung, die Sie mit IF zum Beenden verwenden k\u00f6nnen. Daher w\u00e4re es besser, wenn Sie goto verwenden w\u00fcrden, um IF zu verlassen, bevor die End-Anweisungszeile erreicht wird.<\/p><p> Nehmen wir ein Beispiel, um dies zu verstehen. <\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-57658\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-sortie-vba-si.png\" sizes=\"auto, \" srcset=\"\" alt=\"vba-exit-if\" width=\"620\" height=\"512\"><\/figure><\/div><p> Wie Sie sehen, haben wir im obigen Beispiel eine IF-Anweisung verwendet, um zu pr\u00fcfen, ob in Zelle A1 ein Wert vorhanden ist oder nicht. Wenn Sie <a href=\"https:\/\/exceladvisor.org\/de\/ein-makro-ausfuhren-2\/\">diesen Code ausf\u00fchren<\/a> und in A1 kein Wert vorhanden ist, wechselt VBA zu \u201eLable1\u201c und f\u00fchrt den folgenden Code aus. Daher wird ein Eingabefeld angezeigt, in das Sie den Wert in Zelle A1 eingeben k\u00f6nnen.<\/p><pre class=\"wp-block-code\"> <code class=\"language-visual-basic\" lang=\"visual-basic\">Sub myMacro() If Range(\"A1\") = \"\" Then GoTo Lable1 Else MsgBox \"there's a value in the cell.\" End If Lable1: Range(\"A1\").Value = _ InputBox(\"Enter Value\") End Sub<\/code><\/pre><p class=\"grey-note\"> Es gibt einige Situationen, in denen Sie beim Schreiben von VBA-Code eine IF-Anweisung beenden m\u00fcssen. Wie Sie wissen, kann es in einer einzelnen IF-Anweisung nur zwei Bedingungen geben, und wenn eine Bedingung wahr ist, f\u00fchrt VBA den Code aus, den Sie daf\u00fcr erw\u00e4hnt haben, und beendet die Anweisung dann automatisch.<\/p><div class=\"gb-container gb-container-4db6181c gb-container-mt\"> <a class=\"gb-button gb-button-c5897111 gb-button-text gb-button-mt-button\" href=\"https:\/\/exceladvisor.org\/de\/vba\/\">Was ist VBA<\/a><h2 class=\"gb-headline gb-headline-665e5f6b gb-headline-text gb-headline-mt-heading\"> Verwandte Tutorials <\/h2><div class=\"gb-grid-wrapper gb-grid-wrapper-a20baf7c gb-grid-wrapper-mt-grid\"><div class=\"gb-grid-column gb-grid-column-65ddf67e\"><div class=\"gb-container gb-container-65ddf67e\"><ul><li> <a href=\"https:\/\/exceladvisor.org\/de\/wenn-2\/\">VBA IF (WENN dann sonst)<\/a><\/li><li> <a href=\"https:\/\/exceladvisor.org\/de\/wenn-und\/\">VBA IF und<\/a><\/li><li> <a href=\"https:\/\/exceladvisor.org\/de\/ansonsten\/\">VBA WENN NR<\/a><\/li><li> <a href=\"https:\/\/exceladvisor.org\/de\/ich-fur\/\">VBA WENN ODER<\/a><\/li><li> <a href=\"https:\/\/exceladvisor.org\/de\/nest-wenn\/\">VBA verschachteltes IF<\/a> <\/li><\/ul><\/div><\/div><div class=\"gb-grid-column gb-grid-column-50067b57\"><div class=\"gb-container gb-container-50067b57\"><\/div><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"ub_ctt_via":"","footnotes":""},"class_list":["post-3631","page","type-page","status-publish","hentry"],"featured_image_src":null,"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Wie verwende ich die IF-Anweisung in VBA? (Tutorial 2023)<\/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:\/\/exceladvisor.org\/de\/geh-raus-wenn\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wie verwende ich die IF-Anweisung in VBA? (Tutorial 2023)\" \/>\n<meta property=\"og:url\" content=\"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/\" \/>\n<meta property=\"og:site_name\" content=\"Excel Advisor\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-03T13:05:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-sortie-vba-si.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data1\" content=\"1\u00a0Minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/\",\"url\":\"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/\",\"name\":\"Wie verwende ich die IF-Anweisung in VBA? (Tutorial 2023)\",\"isPartOf\":{\"@id\":\"https:\/\/exceladvisor.org\/de\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-sortie-vba-si.png\",\"datePublished\":\"2023-09-29T01:41:24+00:00\",\"dateModified\":\"2023-12-03T13:05:54+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#primaryimage\",\"url\":\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-sortie-vba-si.png\",\"contentUrl\":\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-sortie-vba-si.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/exceladvisor.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Wie verwende ich die if-anweisung in vba?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/exceladvisor.org\/de\/#website\",\"url\":\"https:\/\/exceladvisor.org\/de\/\",\"name\":\"Excel Advisor\",\"description\":\"Ihr Leitfaden zur Datendominanz\",\"publisher\":{\"@id\":\"https:\/\/exceladvisor.org\/de\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/exceladvisor.org\/de\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/exceladvisor.org\/de\/#organization\",\"name\":\"Excel Advisor\",\"url\":\"https:\/\/exceladvisor.org\/de\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/exceladvisor.org\/de\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/exceladvisor.org\/de\/wp-content\/uploads\/2023\/11\/exceladvisor.org_.png\",\"contentUrl\":\"https:\/\/exceladvisor.org\/de\/wp-content\/uploads\/2023\/11\/exceladvisor.org_.png\",\"width\":105,\"height\":36,\"caption\":\"Excel Advisor\"},\"image\":{\"@id\":\"https:\/\/exceladvisor.org\/de\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Wie verwende ich die IF-Anweisung in VBA? (Tutorial 2023)","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:\/\/exceladvisor.org\/de\/geh-raus-wenn\/","og_locale":"de_DE","og_type":"article","og_title":"Wie verwende ich die IF-Anweisung in VBA? (Tutorial 2023)","og_url":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/","og_site_name":"Excel Advisor","article_modified_time":"2023-12-03T13:05:54+00:00","og_image":[{"url":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-sortie-vba-si.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Gesch\u00e4tzte Lesezeit":"1\u00a0Minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/","url":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/","name":"Wie verwende ich die IF-Anweisung in VBA? (Tutorial 2023)","isPartOf":{"@id":"https:\/\/exceladvisor.org\/de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#primaryimage"},"image":{"@id":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#primaryimage"},"thumbnailUrl":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-sortie-vba-si.png","datePublished":"2023-09-29T01:41:24+00:00","dateModified":"2023-12-03T13:05:54+00:00","breadcrumb":{"@id":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#primaryimage","url":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-sortie-vba-si.png","contentUrl":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-sortie-vba-si.png"},{"@type":"BreadcrumbList","@id":"https:\/\/exceladvisor.org\/de\/geh-raus-wenn\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/exceladvisor.org\/de\/"},{"@type":"ListItem","position":2,"name":"Wie verwende ich die if-anweisung in vba?"}]},{"@type":"WebSite","@id":"https:\/\/exceladvisor.org\/de\/#website","url":"https:\/\/exceladvisor.org\/de\/","name":"Excel Advisor","description":"Ihr Leitfaden zur Datendominanz","publisher":{"@id":"https:\/\/exceladvisor.org\/de\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/exceladvisor.org\/de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/exceladvisor.org\/de\/#organization","name":"Excel Advisor","url":"https:\/\/exceladvisor.org\/de\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/exceladvisor.org\/de\/#\/schema\/logo\/image\/","url":"https:\/\/exceladvisor.org\/de\/wp-content\/uploads\/2023\/11\/exceladvisor.org_.png","contentUrl":"https:\/\/exceladvisor.org\/de\/wp-content\/uploads\/2023\/11\/exceladvisor.org_.png","width":105,"height":36,"caption":"Excel Advisor"},"image":{"@id":"https:\/\/exceladvisor.org\/de\/#\/schema\/logo\/image\/"}}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/exceladvisor.org\/de\/wp-json\/wp\/v2\/pages\/3631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/exceladvisor.org\/de\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/exceladvisor.org\/de\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/exceladvisor.org\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/exceladvisor.org\/de\/wp-json\/wp\/v2\/comments?post=3631"}],"version-history":[{"count":1,"href":"https:\/\/exceladvisor.org\/de\/wp-json\/wp\/v2\/pages\/3631\/revisions"}],"predecessor-version":[{"id":4244,"href":"https:\/\/exceladvisor.org\/de\/wp-json\/wp\/v2\/pages\/3631\/revisions\/4244"}],"wp:attachment":[{"href":"https:\/\/exceladvisor.org\/de\/wp-json\/wp\/v2\/media?parent=3631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}