{"id":4402,"date":"2023-07-11T09:55:11","date_gmt":"2023-07-11T09:55:11","guid":{"rendered":"https:\/\/statorials.org\/nl\/vba-account\/"},"modified":"2023-07-11T09:55:11","modified_gmt":"2023-07-11T09:55:11","slug":"vba-account","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/vba-account\/","title":{"rendered":"Hoe de counta-functie in vba te gebruiken (met voorbeelden)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">U kunt de <strong>CountA-<\/strong> methode in VBA gebruiken om het aantal niet-lege cellen in een specifiek bereik te tellen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Hier is een gebruikelijke manier om deze methode in de praktijk te gebruiken:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubCountARange<\/span> ()\n    Range(\" <span style=\"color: #ff0000;\">C1<\/span> \") = WorksheetFunction.CountA(Range(\" <span style=\"color: #ff0000;\">A1:A10<\/span> \"))\n<span style=\"color: #0000ff;\">End Sub<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Dit specifieke voorbeeld telt het aantal niet-lege cellen in het bereik <strong>A1:A10<\/strong> en geeft het resultaat weer in cel <strong>C1<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Als u in plaats daarvan het aantal niet-lege cellen in een berichtvenster wilt weergeven, kunt u de volgende syntaxis gebruiken:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubCountARange<\/span> ()\n    <span style=\"color: #008000;\">'Create variable to hold results of CountA<\/span>\n    <span style=\"color: #0000ff;\">Dim<\/span> counta <span style=\"color: #0000ff;\">As<\/span> Single\n    \n    <span style=\"color: #008000;\">'Calculate number of non-empty cells in range<\/span>\n    counta = WorksheetFunction.CountA(Range(\" <span style=\"color: #ff0000;\">A1:A10<\/span> \"))\n    \n    <span style=\"color: #008000;\">'Display the result<\/span>\n    MsgBox \" <span style=\"color: #ff0000;\">Number of Non-Empty Cells in Range:<\/span> \" &amp; counta \n<span style=\"color: #0000ff;\">End Sub<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">De volgende voorbeelden laten zien hoe u elk van deze methoden in de praktijk kunt gebruiken met de volgende kolom met waarden in Excel:<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-34510 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/compte11.jpg\" alt=\"\" width=\"506\" height=\"431\" srcset=\"\" sizes=\"auto, \"><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld 1: Tel niet-lege cellen in het bereik en geef de resultaten in de cel weer<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Stel dat we het aantal niet-lege cellen in het bereik <strong>A1:A10<\/strong> willen berekenen en de resultaten in een specifieke cel willen weergeven.<\/span><\/p>\n<p> <span style=\"color: #000000;\">We kunnen hiervoor de volgende macro maken:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubCountARange<\/span> ()\n    Range(\" <span style=\"color: #ff0000;\">C1<\/span> \") = WorksheetFunction.CountA(Range(\" <span style=\"color: #ff0000;\">A1:A10<\/span> \"))\n<span style=\"color: #0000ff;\">End Sub<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Wanneer we deze macro uitvoeren, ontvangen we de volgende uitvoer:<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-34511 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/compte12.jpg\" alt=\"\" width=\"471\" height=\"457\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Merk op dat cel <b>C1<\/b> de waarde <strong>7<\/strong> bevat.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dit vertelt ons dat er 7 niet-lege cellen zijn in het bereik <strong>A1:A10<\/strong> .<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld 2:<\/strong><\/span> <span style=\"color: #000000;\"><strong>Tel niet-lege cellen in het bereik en geef de resultaten weer in<\/strong><\/span> <span style=\"color: #000000;\"><strong>het berichtenvenster<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Stel dat we in plaats daarvan het aantal niet-lege cellen in het bereik <strong>A1:A10<\/strong> willen tellen en de resultaten in een berichtvenster willen weergeven.<\/span><\/p>\n<p> <span style=\"color: #000000;\">We kunnen hiervoor de volgende macro maken:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #0000ff;\">SubCountARange<\/span> ()\n    <span style=\"color: #008000;\">'Create variable to hold results of CountA<\/span>\n    <span style=\"color: #0000ff;\">Dim<\/span> counta <span style=\"color: #0000ff;\">As<\/span> Single\n    \n    <span style=\"color: #008000;\">'Calculate number of non-empty cells in range<\/span>\n    counta = WorksheetFunction.CountA(Range(\" <span style=\"color: #ff0000;\">A1:A10<\/span> \"))\n    \n    <span style=\"color: #008000;\">'Display the result<\/span>\n    MsgBox \" <span style=\"color: #ff0000;\">Number of Non-Empty Cells in Range:<\/span> \" &amp; counta \n<span style=\"color: #0000ff;\">End Sub<\/span><\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Wanneer we deze macro uitvoeren, ontvangen we de volgende uitvoer:<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-34512\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/compte13.jpg\" alt=\"VBA CountA-functievoorbeeld\" width=\"515\" height=\"477\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Het berichtvenster vertelt ons dat er <strong>7<\/strong> niet-lege cellen zijn in het bereik <strong>A1:A10<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Houd er rekening mee dat als u in plaats daarvan het aantal niet-lege cellen in een hele kolom wilt tellen, u in plaats daarvan <strong>A:A<\/strong> kunt typen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Hiermee wordt het aantal niet-lege cellen in heel kolom A berekend.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Opmerking<\/strong> : u kunt <a href=\"https:\/\/learn.microsoft.com\/en-us\/office\/vba\/api\/excel.worksheetfunction.counta\" target=\"_blank\" rel=\"noopener\">hier<\/a> de volledige documentatie voor de VBA <strong>CountA-<\/strong> methode vinden.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">In de volgende tutorials wordt uitgelegd hoe u andere veelvoorkomende taken in VBA kunt uitvoeren:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/nl\/gemiddelde-vba-als\/\" target=\"_blank\" rel=\"noopener\">VBA: Hoe AVERAGEIF- en AVERAGEIFS-functies te schrijven<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/som-vba\/\" target=\"_blank\" rel=\"noopener\">VBA: SUMIF- en SUMIFS-functies schrijven<\/a><br \/> VBA: Hoe COUNTIF- en COUNTIFS-functies te schrijven<\/p>\n","protected":false},"excerpt":{"rendered":"<p>U kunt de CountA- methode in VBA gebruiken om het aantal niet-lege cellen in een specifiek bereik te tellen. Hier is een gebruikelijke manier om deze methode in de praktijk te gebruiken: SubCountARange () Range(&#8220; C1 &#8222;) = WorksheetFunction.CountA(Range(&#8220; A1:A10 &#8222;)) End Sub Dit specifieke voorbeeld telt het aantal niet-lege cellen in het bereik A1:A10 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-4402","post","type-post","status-publish","format-standard","hentry","category-gids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hoe de COUNTA-functie in VBA te gebruiken (met voorbeelden) - Statorials<\/title>\n<meta name=\"description\" content=\"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTA in VBA gebruikt om het aantal niet-lege cellen in een bereik te tellen, met voorbeelden.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/nl\/vba-account\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe de COUNTA-functie in VBA te gebruiken (met voorbeelden) - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTA in VBA gebruikt om het aantal niet-lege cellen in een bereik te tellen, met voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/vba-account\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-11T09:55:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/compte11.jpg\" \/>\n<meta name=\"author\" content=\"Dr.benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr.benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/vba-account\/\",\"url\":\"https:\/\/statorials.org\/nl\/vba-account\/\",\"name\":\"Hoe de COUNTA-functie in VBA te gebruiken (met voorbeelden) - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-11T09:55:11+00:00\",\"dateModified\":\"2023-07-11T09:55:11+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTA in VBA gebruikt om het aantal niet-lege cellen in een bereik te tellen, met voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/vba-account\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/vba-account\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/vba-account\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe de counta-functie in vba te gebruiken (met voorbeelden)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/nl\/#website\",\"url\":\"https:\/\/statorials.org\/nl\/\",\"name\":\"Statorials\",\"description\":\"Uw gids voor statistische competentie\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder\",\"sameAs\":[\"http:\/\/statorials.org\/nl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hoe de COUNTA-functie in VBA te gebruiken (met voorbeelden) - Statorials","description":"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTA in VBA gebruikt om het aantal niet-lege cellen in een bereik te tellen, met voorbeelden.","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:\/\/statorials.org\/nl\/vba-account\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe de COUNTA-functie in VBA te gebruiken (met voorbeelden) - Statorials","og_description":"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTA in VBA gebruikt om het aantal niet-lege cellen in een bereik te tellen, met voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/vba-account\/","og_site_name":"Statorials","article_published_time":"2023-07-11T09:55:11+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/compte11.jpg"}],"author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr.benjamin anderson","Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/vba-account\/","url":"https:\/\/statorials.org\/nl\/vba-account\/","name":"Hoe de COUNTA-functie in VBA te gebruiken (met voorbeelden) - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-11T09:55:11+00:00","dateModified":"2023-07-11T09:55:11+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTA in VBA gebruikt om het aantal niet-lege cellen in een bereik te tellen, met voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/vba-account\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/vba-account\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/vba-account\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe de counta-functie in vba te gebruiken (met voorbeelden)"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/nl\/#website","url":"https:\/\/statorials.org\/nl\/","name":"Statorials","description":"Uw gids voor statistische competentie","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder","sameAs":["http:\/\/statorials.org\/nl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/4402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/comments?post=4402"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/4402\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=4402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=4402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=4402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}