<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>table Archive - Robert Skibbe</title>
	<atom:link href="https://robbelroot.de/blog/tag/table/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>alias RobbelRoot – Freelance Full Stack Developer .NET</description>
	<lastBuildDate>Wed, 25 Mar 2026 17:14:40 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://robbelroot.de/wp-content/uploads/2020/12/cropped-favicon-32x32.png</url>
	<title>table Archive - Robert Skibbe</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to create a VB NET DataGridView filter functionality in 2024</title>
		<link>https://robbelroot.de/blog/creating-a-vb-net-datagridview-filter-functionality/</link>
					<comments>https://robbelroot.de/blog/creating-a-vb-net-datagridview-filter-functionality/#comments</comments>
		
		<dc:creator><![CDATA[Robert Skibbe]]></dc:creator>
		<pubDate>Sun, 13 Feb 2022 06:47:45 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Visual Basic .NET (EN)]]></category>
		<category><![CDATA[Visual Basic .NET troubleshooting]]></category>
		<category><![CDATA[bound]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[datagrid]]></category>
		<category><![CDATA[datagridview]]></category>
		<category><![CDATA[dataview]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[functionality]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[raw]]></category>
		<category><![CDATA[row]]></category>
		<category><![CDATA[rows]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[selection]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[tabular]]></category>
		<category><![CDATA[unbound]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vb.net]]></category>
		<category><![CDATA[vbnet]]></category>
		<category><![CDATA[view]]></category>
		<category><![CDATA[virtual]]></category>
		<category><![CDATA[visual basic]]></category>
		<guid isPermaLink="false">https://robbelroot.de/?p=9013</guid>

					<description><![CDATA[<p>How to make a VB NET DataGridView filter!? I welcome you to todays post on &#8222;How to make a VB NET DataGridView filter&#8222;! Maybe you came across randomly, or you actively searched for that typical issue. If you&#8217;ve searched it, well theres no big surprise, because it&#8217;s one well known &#8230;</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/creating-a-vb-net-datagridview-filter-functionality/">How to create a VB NET DataGridView filter functionality in 2024</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-filter-functionality.jpg"><img fetchpriority="high" decoding="async" width="1200" height="628" src="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-filter-functionality.jpg" alt="VB NET DataGridView filter functionality" class="wp-image-9016" title="VB NET DataGridView filter functionality"/></a><figcaption class="wp-element-caption">VB NET DataGridView filter functionality</figcaption></figure>






<h2 class="wp-block-heading" id="how-to-make-a-vb-net-datagridview-filter">How to make a VB NET DataGridView filter!?</h2>



<p>I <strong>welcome </strong>you to todays post on &#8222;How to make a <strong>VB NET DataGridView filter</strong>&#8222;!</p>



<p><strong>Maybe</strong> you <strong>came across </strong>randomly, <strong>or </strong>you actively <strong>searched </strong>for that typical issue.</p>



<p><strong>If </strong>you&#8217;ve <strong>searched </strong>it, well theres <strong>no big surprise</strong>, because it&#8217;s one <strong>well known problem</strong>.</p>



<p><strong>Literally every</strong> (VB NET) <strong>Developer </strong>will face this issue <strong>from time to time</strong>, or <strong>even more than once</strong>.</p>



<p><strong>Usually </strong>you have that <strong>typical user interface</strong> <strong>with </strong>some kind of <strong>listing</strong>, whether it&#8217;s a typical <strong>table </strong>(hence a <strong><a href="https://docs.microsoft.com/de-de/dotnet/api/system.windows.forms.datagridview" target="_blank" rel="noreferrer noopener">DataGridView</a></strong>) <strong>or it&#8217;s based on tiles</strong>.</p>



<p>If the <strong>user </strong>will then <strong>click </strong>on one of those <strong>rows or tiles</strong>, you <strong>will </strong>mostly <strong>show </strong>some fancy <strong>dialog </strong>thingy, <strong>to edit </strong>this data.</p>



<p><strong>After </strong>the <strong>user </strong>has <strong>finished working </strong>on that detail dialog, it will usually <strong>close and save </strong>the <strong>changed data </strong>back to the data source.</p>



<h3 class="wp-block-heading" id="preview-of-what-we-are-going-to-build">Preview of what we are going to build</h3>



<p>As I&#8217;m a <strong>fan of action instead</strong> of <strong>talking </strong>only, here&#8217;s a <strong>brief example</strong> of what we are going to build.</p>



<p>We will have <strong>a basic form</strong> split in <strong>two areas</strong>:</p>



<ul class="wp-block-list">
<li><strong>One area for </strong>some sort of <strong>search inputs</strong> (add as much as you like)</li>



<li>The second area is an auto <strong>growing / shrinking datagridview</strong></li>
</ul>



<p>You can <strong>enter </strong>a specific <strong>search text</strong> <strong>and </strong>then <strong>confirm </strong>the search by <strong>pressing enter</strong> <strong>or </strong>the corresponding <strong>button</strong>.</p>



<p>There will be <strong>some kind of reset</strong> functionality by <strong>clicking </strong>the &#8222;<strong>X</strong>&#8222;-button, or by using the <strong>escape key</strong>.</p>



<figure class="wp-block-image size-full" id="application-preview"><a href="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-Filter-Application-Preview-1.gif"><img decoding="async" width="799" height="481" src="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-Filter-Application-Preview-1.gif" alt="VB NET DataGridView Filter Application Preview" class="wp-image-9058" title="VB NET DataGridView Filter Application Preview"/></a><figcaption class="wp-element-caption">VB NET DataGridView Filter Application Preview</figcaption></figure>



<h3 class="wp-block-heading" id="one-very-basic-task">One very basic task</h3>



<p>So it&#8217;s <strong>actually</strong> one of the big <strong>basic tasks</strong>, you need to understand in <strong>detail</strong>.</p>



<p>In <strong>this post</strong>, you will get a <strong>nice datagridview filtering</strong> example with some <strong>sub-steps</strong>.</p>



<p>This will consist of <strong>acquiring data </strong>from the very base, over <strong>creating </strong>a nice <strong>GUI to </strong>get user <strong>input </strong>and at last <strong>filtering </strong>that <strong>data</strong>.</p>



<p>To <strong>actually search </strong>for anything, you will <strong>need </strong>some kind of <strong>data source</strong>, right!?</p>



<p>Some <strong>sweet spot</strong>, <strong>where </strong>the <strong>data is </strong>actually <strong>coming from</strong>, <strong>whether </strong>it&#8217;s</p>



<ul class="wp-block-list">
<li>A <strong>database</strong>-ish thingy</li>



<li>Some &#8222;<strong>In-Memory</strong>&#8220; cache</li>



<li>Or <strong>maybe </strong>some <strong>file</strong> based <strong>storage </strong>like a <strong>text file</strong></li>
</ul>



<p><strong>Otherwise </strong>it would be kinda <strong>hard </strong>to actually find out:</p>



<ul class="wp-block-list">
<li><strong>when </strong>to retrieve data?</li>



<li>from <strong>where</strong>?</li>



<li>or most <strong>importantly </strong>&#8211; <strong>how</strong>?</li>
</ul>



<h3 class="wp-block-heading" id="thinking-about-structure">Thinking about structure</h3>



<p><strong>Surely </strong>you should <strong>structure </strong>your <strong>application </strong>in a <strong>properly </strong>designed way &#8211; like always!</p>



<p>What I&#8217;m talking about is: Using <strong>interfaces for abstracting </strong>away implementation details.</p>



<p>This <strong>makes </strong>our <strong>application </strong>much more <strong>flexible </strong>thus being able to switch out dependencies easily.</p>



<p>Or something like <strong>dependency injection</strong>, <strong>to provide</strong> needed <strong>dependencies </strong>from the outside.</p>



<p>With this approach, we <strong>can avoid hardcoding dependencies </strong>inside the classes themselves.</p>



<p>But we <strong>will dive </strong>much <strong>deeper </strong>on that <strong>in separate </strong>blog <strong>posts</strong>, so i may <strong>only touch </strong>the very <strong>basics </strong>here – if at all &#x1f937;&#x200d;&#x2642;&#xfe0f;.</p>



<h2 class="wp-block-heading" id="different-situations-require-different-solutions">Different situations require different solutions</h2>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-filter-Different-initial-situations.jpg"><img decoding="async" width="1200" height="628" src="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-filter-Different-initial-situations.jpg" alt="VB NET DataGridView filter - Different initial situations" class="wp-image-9131" title="VB NET DataGridView filter - Different initial situations"/></a><figcaption class="wp-element-caption">VB NET DataGridView filter &#8211; Different initial situations</figcaption></figure>



<p>As you might know, <strong>there are quite a few</strong> different <strong>situations </strong>of <strong>having data inside </strong>your <strong>DataGridView</strong>.</p>



<p>The <strong>3 methods below</strong> are the ones I&#8217;ve seen the most:</p>



<ul class="wp-block-list">
<li><strong>Adding </strong>data <strong>directly</strong></li>



<li>A <strong>list of objects </strong>as source</li>



<li>The thing called <strong>DataView</strong></li>
</ul>



<p>To <strong>elaborate on </strong>this further: <strong>Basically </strong>you have <strong>3 modes</strong> to work with the DataGridView.</p>



<p>Keep in mind, that <strong>those 3</strong> here <strong>don&#8217;t necessarily match up</strong> to the ones above, <strong>as 2</strong> of the ones above <strong>are </strong>basically <strong>bound</strong>.</p>



<ul class="wp-block-list">
<li><strong>Unbound</strong></li>



<li><strong>Bound</strong></li>



<li><strong>Virtual</strong></li>
</ul>



<p>You can <strong>find more </strong>detailed <strong>information </strong>on that, you can <strong><a href="https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/data-display-modes-in-the-windows-forms-datagridview-control" target="_blank" rel="noreferrer noopener">visit the microsoft documentation</a></strong> for that.</p>



<p><strong>Honestly </strong>I would <strong>recommend </strong>you reading <strong>my example implementations</strong> as they are much <strong>easier </strong>to understand and follow.</p>



<h3 class="wp-block-heading" id="adding-data-directly-to-the-datagridview-don-t">Adding data directly to the DataGridView – Don&#8217;t!</h3>



<p>The <strong>easiest </strong>and most <strong>beginner friendliest way </strong>is to <strong>directly add </strong>your <strong>data </strong>to the DataGridView.</p>



<p>This is <strong>done by calling </strong>some kind of &#8222;CollectionThingy.<strong>Add</strong>&#8220; <strong>functionality</strong>.</p>



<p><strong>Even though </strong>this <strong>seems </strong>to be the easy &#8222;Hey, I could just go like this&#8220; way, it <strong>isn&#8217;t</strong> necessarily <strong>the best one</strong>.</p>



<p>I&#8217;m <strong>talking about structuring</strong> and especially about <strong>maintaining and advancing </strong>development.</p>



<p>I&#8217;ve <strong>seen myself struggling through </strong>other developers <strong>chaotic </strong>&#8222;DataGridView.Rows.<strong>Add</strong>&#8220; <strong>code </strong>so many times.</p>



<p>So I would <strong>highly </strong>(really) <strong>recommend </strong>you <strong>not to do it this way</strong>!</p>



<h3 class="wp-block-heading" id="using-a-list-as-datasource">Using a list as datasource</h3>



<p><strong>Using </strong>a <strong>pure list</strong> – a special one – is <strong>actually my </strong>personally <strong>most used </strong>style of populating a DataGridView.</p>



<p><strong>Therefore </strong>I also like to <strong>filter</strong> the <strong>data directly </strong>by using that list, <strong>instead of </strong>operating on those DataGridView <strong>rows </strong>themselves.</p>



<p>This <strong>works strongly typed </strong>and is (at least in my opinion) <strong>easy </strong>to implement.</p>



<p>It also <strong>feels kinda clean</strong> like &#8222;filtering customers by filtering customers&#8220; you know what I mean!?</p>



<p>I would <strong>recommend this </strong>method <strong>and </strong>this is <strong>actually </strong>the <strong>method </strong>we&#8217;re <strong>using in our first example</strong> here.</p>



<h3 class="wp-block-heading" id="utilizing-a-dataview">Utilizing a DataView</h3>



<p>This is actually my <strong>personally least used method of filtering</strong> or populating <strong>data </strong>inside a DataGridView.</p>



<p><strong>Honestly </strong>I <strong>can&#8217;t</strong> even <strong>remember when </strong>I <strong>used </strong>that method the last time so..</p>



<p><strong>Maybe </strong>I&#8217;ll <strong>add some example </strong>of using this at a <strong>later </strong>point, because I want to <strong>focus on </strong>the <strong>most used </strong>style first.</p>



<h2 class="wp-block-heading" id="using-a-bound-list-for-a-vb-net-datagridview-filter">Using a bound list for a VB NET DataGridView filter</h2>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-filter-A-basic-way.jpg"><img loading="lazy" decoding="async" width="1200" height="628" src="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-filter-A-basic-way.jpg" alt="VB NET DataGridView filter - A basic way" class="wp-image-9049" title="VB NET DataGridView filter - A basic way"/></a><figcaption class="wp-element-caption">VB NET DataGridView filter &#8211; A basic way</figcaption></figure>



<p>So in the <strong>very first</strong> and most &#8222;natural&#8220; kind of <strong>DataGridView filter example</strong>, we will touch the clean basics.</p>



<p>In a few moments, you <strong>will understand </strong>this &#8222;<strong>clean</strong>&#8220; &amp; &#8222;<strong>natural</strong>&#8220; thing <strong>and </strong>the &#8222;<strong>why&#8220; </strong>behind that.</p>



<p>I think that <strong>this </strong>is actually <strong>one of the easiest ways</strong> to understand, as there are <strong>no </strong>fancy or <strong>complex </strong>other <strong>tools </strong>involved.</p>



<p>But well, <strong>one additional</strong> &#8222;<strong>helper</strong>&#8220; <strong>is </strong>actually <strong>used</strong>, as we are in the need of some kind of <strong>listing functionality</strong>.</p>



<p>This <strong>listing thing is </strong>actually <strong>responsible for holding </strong>those different <strong>entries and </strong>being able to <strong>communicate </strong>it&#8217;s internal <strong>changes</strong>.</p>



<p>With <strong>those communication skills</strong>, the <strong>outer </strong>world <strong>can react </strong>to changes <strong>by </strong>like <strong>refreshing </strong>their <strong>graphical representation</strong>.</p>



<h3 class="wp-block-heading" id="an-easy-and-clean-data-source-an-extended-bindinglist">An easy and clean data source – An extended BindingList</h3>



<p>So in this <strong>very first example</strong> we will use a basic <strong>BindingList</strong> as indirect data source.</p>



<p>As <strong>I really prefer</strong> the <strong>object oriented way</strong> the most, we will <strong>create </strong>the <strong>data based on </strong>defined class <strong>instances</strong>.</p>



<p>This <strong>means </strong>we will <strong>need a class</strong> to create some kind of <strong>blueprint</strong>, that <strong>enables </strong>us <strong>encapsulating </strong>the needed data.</p>



<p><strong>After </strong>that and after <strong>instantiating </strong>some <strong>objects</strong>, we can <strong>tell </strong>the <strong>DataGridView </strong>to <strong>display </strong>the data.</p>



<p>Or <strong>better said</strong>, we can tell the grid to <strong>use these</strong> object <strong>instances as datasource</strong> – nice!</p>



<p><strong>One </strong>big <strong>problem </strong>with the default <a href="https://docs.microsoft.com/de-de/dotnet/api/system.componentmodel.bindinglist-1" target="_blank" rel="noreferrer noopener">BindingList</a> class is, that you <strong>can&#8217;t</strong> really <strong>add multiple items </strong>at once.</p>



<p>As <strong>you will see later</strong>, we will <strong>need that </strong>functionality, so we will <strong>define </strong>a small <strong>helper extension method</strong> first.</p>



<p><strong>Create </strong>a <strong>folder </strong>called &#8222;<strong>Utils</strong>&#8222;, put the <strong>following class </strong>inside and <strong>watch out for namespacing</strong> issues:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Imports System.ComponentModel
Imports System.Runtime.CompilerServices

Namespace Utils

    Module BindingListExtensions

        &lt;Extension()>
        Public Sub AddRange(Of T)(bindingList As BindingList(Of T), collection As IEnumerable(Of T))
            Dim oldRaiseEvents = bindingList.RaiseListChangedEvents
            bindingList.RaiseListChangedEvents = False
            Try
                For Each item In collection
                    bindingList.Add(item)
                Next
            Finally
                bindingList.RaiseListChangedEvents = oldRaiseEvents
                If bindingList.RaiseListChangedEvents Then
                    bindingList.ResetBindings()
                End If
            End Try
        End Sub

    End Module

End Namespace</pre>



<p>With <strong>this BindingList</strong> class <strong>extending </strong>functionality, we will be able to <strong>add multiple items</strong>.</p>



<p>In addition, this <strong>won&#8217;t trigger</strong> a &#8222;Hey I&#8217;ve changed&#8220;-<strong>notification </strong>for each add, <strong>this would be inefficient</strong>.</p>



<p><strong>Imagine </strong>you would be <strong>adding 30000 items</strong> and therefore 30000 change notifications would be triggered.</p>



<p><strong>Wouldn&#8217;t it</strong> simply <strong>be enough</strong> to <strong>add </strong>those <strong>elements and notify </strong>about a change of this list <strong>after </strong>all <strong>work </strong>has been <strong>done </strong>– meaning <strong>once</strong>!?</p>



<p>For this to work, we <strong>need to disable</strong> the <strong><a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.bindingsource.raiselistchangedevents" target="_blank" rel="noreferrer noopener">&#8222;RaiseListChangedEvents&#8220;-property</a></strong> <strong>temporarily</strong>, or <strong>as long </strong>as the adding <strong>process </strong>is <strong>ongoing</strong>.</p>



<p>As this is <strong>one very basic requirement</strong> for many projects, you <strong>should </strong>really be <strong>saving </strong>that <strong>extension method </strong>somewhere &#x1f61b;!</p>



<p>Let&#8217;s go to the <strong>next step</strong> of making that <strong>VB NET DataGridView filter</strong> functionality!</p>



<h3 class="wp-block-heading" id="creating-the-customer-class">Creating the customer class</h3>



<p>So let&#8217;s <strong>now go ahead and</strong> actually <strong>create </strong>this blueprint <strong>class </strong>called &#8222;<strong>Customer</strong>&#8220; for our first example.</p>



<p>I mean seriously, who doesn&#8217;t like <strong>working with (good, on time paying) customers</strong> &#x1f61b;.</p>



<p><strong>Keep in mind</strong>, that <strong>this example</strong> will <strong>only contain</strong> like <strong>basic data</strong> and no deep structures.</p>



<p>Take <strong>care putting </strong>the class into the correctly <strong>named folder</strong> <strong>and </strong>watch the <strong>namespace</strong>!</p>



<p><strong>Create </strong>a <strong>folder </strong>called &#8222;<strong>Models</strong>&#8220; and <strong>add</strong> the following <strong>class inside</strong>:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Namespace Models

    Public Class Customer

        Public Property FirstName As String

        Public Property LastName As String

        Public Property Company As String

        Sub New(firstName As String, lastName As String, company As String)
            Me.FirstName = firstName
            Me.LastName = lastName
            Me.Company = company
        End Sub

    End Class

End Namespace
</pre>



<h3 class="wp-block-heading" id="creating-the-user-interface-for-the-vb-net-datagridview-filter-example">Creating the user interface for the VB NET DataGridView filter example</h3>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-filter-user-interface.jpg"><img loading="lazy" decoding="async" width="1200" height="628" src="https://robbelroot.de/wp-content/uploads/2022/02/VB-NET-DataGridView-filter-user-interface.jpg" alt="Creating the user interface" class="wp-image-9151" title="Creating the user interface"/></a><figcaption class="wp-element-caption">Creating the user interface</figcaption></figure>



<p><strong>In </strong>this <strong>last step</strong> of the first example, we will actually <strong>work on <a href="https://en.wikipedia.org/wiki/Graphical_user_interface" target="_blank" rel="noreferrer noopener">the graphical user interface</a></strong> (GUI) part.</p>



<p>As <strong>this </strong>is a <strong>DataGridView example</strong> (so no WPF involved), we will <strong>use a</strong> good old <strong>Windows Forms Project</strong> (Winforms project).</p>



<p><strong>If you </strong>have <strong>missed </strong>the example preview, you can <strong>scroll back to</strong> the above <strong>section <a href="#application-preview">here</a></strong>.</p>



<h4 class="wp-block-heading" id="needed-controls">Needed controls</h4>



<p>So in order <strong>to create </strong>our example <strong>user interface </strong>we <strong>need </strong>the following controls:</p>



<ul class="wp-block-list">
<li>A <strong>form</strong> with set StartPosition, Text and size</li>



<li>One <strong>TableLayoutPanel </strong>(as we want dynamic resizing)</li>



<li><strong>Groupboxes </strong>(2) for the main areas</li>



<li>One <strong>FlowLayoutPanel</strong> for arranging the search inputs</li>



<li>a <strong>Textbox </strong>for searching by text input</li>



<li><strong>2 buttons </strong>(searching and resetting the search)</li>



<li>The last control is the <strong>DataGridView</strong> itself</li>
</ul>



<p><strong>Surely </strong>you can <strong>add or remove</strong> things <strong>on </strong>your personal <strong>needs</strong>..</p>



<h3 class="wp-block-heading" id="the-code-vb-net-datagridview-filter-example-1">The Code – VB NET DataGridView filter example 1</h3>



<p>Now, <strong>inside </strong>our <strong>code</strong>, we will start by <strong>importing </strong>all <strong>necessary namespaces</strong>.</p>



<p>I <strong>called my example</strong> project &#8222;<strong>VBDataGridViewFilterExample</strong>&#8222;, so <strong>make sure to adjust</strong> that to your project name if needed.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Imports System.ComponentModel
Imports VBDataGridViewFilterExample.Models
Imports VBDataGridViewFilterExample.Utils</pre>



<h4 class="wp-block-heading" id="the-forms-properties">The forms properties</h4>



<p><strong>Then </strong>we will need to <strong>define 3 properties</strong> <strong>inside </strong>our &#8222;<strong>Form1</strong>&#8220; class (or however you&#8217;ve called it).</p>



<p>The <strong>first property</strong> called &#8222;<strong>Customers</strong>&#8220; is the <strong>storage for </strong>our <strong>customer </strong>instances.</p>



<p><strong>As </strong>I have <strong>mentioned above </strong>you should <strong>go for </strong>something like <strong>dependency injection</strong>, etc.</p>



<p>In <strong>this case</strong> it will be <strong>enough </strong>working <strong>like this</strong>, as I don&#8217;t want to make it too difficult anyways.</p>



<p>The next property &#8222;<strong>FilteredCustomers</strong>&#8220; <strong>will be</strong> the actual (potentially filtered) <strong>customers </strong>list, which is the <strong>datasource for </strong>our <strong>DataGridView</strong>.</p>



<p>Finally, <strong>the last property</strong> is some kind of <strong>user input</strong> field, where the <strong>user can</strong> enter some string to <strong>filter </strong>the <strong>customers </strong>by.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    Public Property Customers As List(Of Customer)

    Public Property FilteredCustomers As BindingList(Of Customer)

    Public Property SearchText As String</pre>



<h4 class="wp-block-heading" id="instantiating-the-form-the-constructor">Instantiating the form – The Constructor</h4>



<p><strong>Now </strong>it&#8217;s <strong>time to</strong> let the form actually come to reality by <strong>filling </strong>its <strong>constructor</strong> code.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Sub New()
    InitializeComponent()
    Customers = New List(Of Customer)()
    FilteredCustomers = New BindingList(Of Customer)()
    SearchText = String.Empty
    tbSearch.DataBindings.Add(NameOf(Text), Me, NameOf(SearchText), False, DataSourceUpdateMode.OnPropertyChanged)
End Sub</pre>



<p>The <strong>first</strong> <strong>call </strong>is the &#8222;<strong>InitializeComponent</strong>&#8222;-function – <strong>like </strong>literally <strong>always</strong>.</p>



<p><strong>Next</strong>, we will <strong>instantiate both list </strong>objects called &#8222;Customers&#8220; and &#8222;FilteredCustomers&#8220;.</p>



<p><strong>Then </strong>we are going to <strong>initialize </strong>the &#8222;<strong>SearchText</strong>&#8220; property <strong>with </strong>an <strong>empty string</strong>, so it&#8217;s not &#8222;Nothing&#8220;.</p>



<h4 class="wp-block-heading" id="the-forms-load-eventhandler">The forms Load-EventHandler</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    tbSearch.DataBindings.Add(NameOf(Text), Me, NameOf(SearchText), False, DataSourceUpdateMode.OnPropertyChanged)
    LoadTestCustomers()
    dgvCustomers.DataSource = FilteredCustomers
    SearchCustomers()
End Sub</pre>



<p><strong>Inside </strong>the forms <strong>load eventhandler</strong>, theres also some work to do like <strong>configuring </strong>the <strong>bindings</strong>, etc.</p>



<p>So let&#8217;s <strong>start </strong>by <strong>binding </strong>the &#8222;<strong>SearchText</strong>&#8222;-property <strong>to </strong>our <strong>corresponding textboxes</strong> &#8222;Text&#8220;-property.</p>



<p>We are <strong>using a nice operator</strong> called &#8222;<strong><a href="https://docs.microsoft.com/de-de/dotnet/visual-basic/language-reference/operators/nameof" target="_blank" rel="noreferrer noopener">NameOf</a></strong>&#8222;, as this <strong>can help with later naming conflicts</strong>.</p>



<p><strong>If </strong>you would be <strong>calling</strong>:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">tbSearch.DataBindings.Add(Text, Me, "SearchText", False, DataSourceUpdateMode.OnPropertyChanged)</pre>



<p><strong>and change </strong>the &#8222;SearchText&#8220;-<strong>property </strong>to a different name later on, you could run into problems.</p>



<p><strong>Changing </strong>&#8222;SearchText&#8220; <strong>to </strong>like &#8222;<strong>Search</strong>&#8222;, <strong>would </strong>lead the binding above to <strong>fail</strong>, if you don&#8217;t apply the change there as well.</p>



<p>But <strong>changing when using </strong>the &#8222;<strong>NameOf</strong>&#8222;-operator <strong>will </strong>instantly <strong>notify you </strong>about this.</p>



<p>I <strong>will talk about </strong>that &#8222;<strong>DataSourceUpdateMode</strong>&#8222;-part in a few moments, so be patient.</p>



<p><strong>Then </strong>we will <strong>continue </strong>by <strong>loading </strong>some <strong>customer test data</strong> into our backing storage list.</p>



<p>You <strong>will see </strong>the <strong>implementation </strong>for that method in some seconds, <strong>too</strong>!</p>



<p><strong>After that</strong>, we&#8217;re <strong>setting </strong>the <strong>DataGridViews DataSource </strong>property, to our &#8222;<strong>FilteredCustomers</strong>&#8220; BindingList.</p>



<p>In the <strong>last step</strong> <strong>of </strong>the <strong>load </strong>eventhandler, we will <strong>trigger</strong> a <strong>simulated search</strong>, to <strong>make </strong>some <strong>data appear </strong>at the start.</p>



<h4 class="wp-block-heading" id="the-loadtestcustomers-method">The LoadTestCustomers method</h4>



<p>This method will <strong>load some test customers</strong> <strong>into </strong>our basic storage <strong>list</strong>.</p>



<p>So nothing big is happening here, except <strong>creating 3 customers</strong> and adding them to the list.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Private Sub LoadTestCustomers()
    Customers.Add(New Customer("John", "Doe", "JD Company"))
    Customers.Add(New Customer("Jane", "Doe", "JANE Ltd."))
    Customers.Add(New Customer("Maximillion", "Pegasus", "Industrial Illusions"))
End Sub</pre>



<h4 class="wp-block-heading" id="searchcustomers-method-definition">SearchCustomers method definition</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Private Sub SearchCustomers()
    If FilteredCustomers.Count > 0 Then
        FilteredCustomers.Clear()
    End If
    Dim searchResults = Customers.Where(AddressOf FilterCustomers)
    FilteredCustomers.AddRange(searchResults)
End Sub</pre>



<p>The &#8222;<strong>SearchCustomers</strong>&#8220; method will <strong>do</strong> the <strong>searchy work</strong> and <strong>add </strong>the <strong>results </strong>to our bound result list.</p>



<p><strong>As </strong>you may have already <strong>guessed</strong>, we <strong>will need </strong>that defined <strong>extension method </strong>from above.</p>



<p><strong>First </strong>it will <strong>clear out </strong>already <strong>existing customers </strong>(if there are any), so that we are <strong>starting </strong>in a <strong>clean </strong>way.</p>



<p>Then it&#8217;s using the <strong><a href="https://de.wikipedia.org/wiki/LINQ" target="_blank" rel="noreferrer noopener">LINQ</a></strong> helper method called &#8222;<a href="https://docs.microsoft.com/de-de/dotnet/api/system.linq.enumerable.where" target="_blank" rel="noreferrer noopener"><strong>Where</strong></a>&#8220; to apply our <strong>defined filtering function</strong> coming in a second.</p>



<p><strong>After </strong>we <strong>got </strong>our <strong>results</strong>, we can <strong>add them </strong>by the defined &#8222;<strong>AddRange</strong>&#8220; method <strong>from </strong>the <strong>top </strong>of this post.</p>



<h4 class="wp-block-heading" id="performing-the-filtering-by-filtercustomers-method">Performing the filtering by FilterCustomers method</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Private Function FilterCustomers(customer As Customer) As Boolean
    Dim searchText = Me.SearchText.ToLower()
    Dim company = customer.Company.ToLower()
    Dim firstName = customer.FirstName.ToLower()
    Dim lastName = customer.LastName.ToLower()
    Return company.Contains(searchText) OrElse
        firstName.Contains(searchText) OrElse
        lastName.Contains(searchText)
End Function</pre>



<p><strong>Now </strong>it&#8217;s time to <strong>define </strong>the <strong>predicate function </strong>for doing the actual filter work.</p>



<p>A <strong>customer does match</strong> our filter criteria, <strong>if </strong>the <strong>value </strong>of the &#8222;SearchText&#8220; property (lowered) <strong>is contained </strong>in:</p>



<ul class="wp-block-list">
<li>either, the <strong>company</strong></li>



<li>the <strong>first name</strong></li>



<li>or the <strong>last name</strong></li>
</ul>



<p><strong>Keep an eye on</strong> that &#8222;<strong><a href="https://docs.microsoft.com/de-de/dotnet/visual-basic/language-reference/operators/orelse-operator" target="_blank" rel="noreferrer noopener">OrElse</a></strong>&#8220; operator, as it&#8217;s <strong>enough if</strong> just <strong>one </strong>of this boolean expressions <strong>match</strong>.</p>



<p>So by just <strong>using </strong>&#8222;<strong>Or</strong>&#8220; it <strong>would</strong> still <strong>check all 3 expressions </strong>– which is <strong>inefficient</strong>!</p>



<h4 class="wp-block-heading" id="reacting-to-user-pressing-enter-a-ui-ux-thingy">Reacting to user pressing Enter – a UI/UX thingy</h4>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Private Sub tbSearch_KeyDown(sender As Object, e As KeyEventArgs) Handles tbSearch.KeyDown
    If e.KeyCode = Keys.Enter Then
        e.Handled = True
        ' disable DING sound
        e.SuppressKeyPress = True
        SearchCustomers()
    End If
End Sub</pre>



<p>One <strong>basic functionality </strong>when <strong>creating </strong>some <strong>filtering mechanism </strong>should be to <strong>trigger </strong>the <strong>search by </strong>pressing a <strong>hotkey</strong>.</p>



<p><strong>If </strong>the <strong>user presses </strong>the &#8222;<strong>Enter</strong>&#8220; key inside the textbox, we <strong>will </strong>react by <strong>triggering </strong>the <strong>search</strong>.</p>



<p>But <strong>before </strong>finally <strong>triggering </strong>that <strong>search</strong>, we are setting the &#8222;<a href="https://docs.microsoft.com/de-de/dotnet/api/system.windows.forms.keypresseventargs.handled?view=windowsdesktop-6.0" target="_blank" rel="noreferrer noopener"><strong>Handled</strong></a>&#8220; event <strong>argument property</strong>.</p>



<p>We are <strong>also setting </strong>the &#8222;<strong><a href="https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.keyeventargs.suppresskeypress?view=windowsdesktop-6.0" target="_blank" rel="noreferrer noopener">SuppressKeyPress</a></strong>&#8220; property, to avoid that annoying windows sided &#8222;DING&#8220; sound.</p>



<p>Let&#8217;s <strong>talk about</strong> that &#8222;<strong>DataSourceUpdateMode</strong>&#8220; thing I&#8217;ve mentioned a few moments ago.</p>



<p>This thing <strong>will configure </strong>the &#8222;<strong>SearchProperty</strong>&#8220; actually <strong>getting changed live</strong>.</p>



<p>If we would <strong>not be using that</strong>, you <strong>could trigger </strong>the search by pressing enter, <strong>but </strong>the <strong>actual text wouldn&#8217;t be used</strong>.</p>



<p>This <strong>happens</strong>, <strong>because </strong>the input <strong>text </strong>of the textbox <strong>only gets &#8222;forwarded&#8220;</strong> to our &#8222;SearchText&#8220; <strong>after leaving </strong>the <strong>textbox</strong>!</p>



<h4 class="wp-block-heading" id="the-button-event-handlers">The button event handlers</h4>



<p>So <strong>at the end</strong> of the first codes example, theres just one (or two things) left.</p>



<p>I&#8217;m <strong>talking about </strong>these two <strong>buttons </strong>whose click events need to be handled.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Private Sub btnResetSearch_Click(sender As Object, e As EventArgs) Handles btnResetSearch.Click
    tbSearch.Clear()
    SearchCustomers()
End Sub

Private Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click
    SearchCustomers()
End Sub</pre>



<p>We are making sure, to <strong>reset </strong>the <strong>search and showing all customers </strong>when pressing the reset button.</p>



<p><strong>Then </strong>we are <strong>handling </strong>the <strong>normal search </strong>button click by <strong>triggering </strong>the <strong>search </strong>process.</p>



<h2 class="wp-block-heading" id="conclusion">Conclusion</h2>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2022/02/Conclusion.jpg"><img loading="lazy" decoding="async" width="1200" height="628" src="https://robbelroot.de/wp-content/uploads/2022/02/Conclusion.jpg" alt="Creating a VB NET DataGridView filter functionality - conclusion" class="wp-image-8867" title="Creating a VB NET DataGridView filter functionality - conclusion"/></a><figcaption class="wp-element-caption">Creating a VB NET DataGridView filter functionality &#8211; conclusion</figcaption></figure>



<p>So <strong>now </strong>that we&#8217;ve <strong>come to the end</strong> of todays blog post, let&#8217;s <strong>do a</strong> quick <strong>recap</strong>.</p>



<p><strong>When </strong>it comes to <strong>displaying data in a tabular style</strong>, you are almost <strong>guaranteed </strong>to stumble upon <strong>DataGridViews</strong>.</p>



<p>But – like as usual – in the daily life of being a programmer, you <strong>will face more requirements</strong>.</p>



<p>So even if you managed to <strong>display</strong> <strong>data inside </strong>a <strong>DataGridView</strong>, you will get <strong>more requests </strong>like <strong>filtering</strong>, <strong>sorting </strong>and <strong>more</strong>.</p>



<p>In todays post I <strong>showed you </strong>one possible way of <strong>filtering data</strong> inside that tabular standard control.</p>



<p><strong>Next to </strong>that already <strong>existing method </strong>showed above, I think I <strong>will update this post</strong> in the future to show more.</p>



<h2 class="wp-block-heading" id="downloads">Downloads</h2>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="https://bit.ly/vbnet-datagridview-filter-download-en" target="_blank" rel="noreferrer noopener">VBDataGridViewFilterExample.zip</a></div>
</div>



<h2 class="wp-block-heading" id="related-posts">Related posts</h2>



<ul class="wp-block-list">
<li><strong><a href="https://robbelroot.de/blog/vb-net-removing-items-from-listboxes/" target="_blank" rel="noreferrer noopener">Removing Items from ListBoxes in VB NET</a></strong></li>



<li><strong><a href="https://robbelroot.de/blog/hacking-a-net-application/" target="_blank" rel="noreferrer noopener">Hacking a VB NET Application – or avoid getting hacked</a></strong></li>
</ul>
<p>Der Beitrag <a href="https://robbelroot.de/blog/creating-a-vb-net-datagridview-filter-functionality/">How to create a VB NET DataGridView filter functionality in 2024</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://robbelroot.de/blog/creating-a-vb-net-datagridview-filter-functionality/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>Excel online</title>
		<link>https://robbelroot.de/blog/excel-online/</link>
					<comments>https://robbelroot.de/blog/excel-online/#comments</comments>
		
		<dc:creator><![CDATA[Robert Skibbe]]></dc:creator>
		<pubDate>Fri, 13 Aug 2021 18:07:33 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Excel Lernen]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[calculation]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[excel online]]></category>
		<category><![CDATA[formel]]></category>
		<category><![CDATA[formeln]]></category>
		<category><![CDATA[lösung]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[msft]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[reihe]]></category>
		<category><![CDATA[reihen]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[spalte]]></category>
		<category><![CDATA[spalten]]></category>
		<category><![CDATA[tabelle]]></category>
		<category><![CDATA[tabellen]]></category>
		<category><![CDATA[tabellenkalkulation]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[tables]]></category>
		<category><![CDATA[zelle]]></category>
		<category><![CDATA[zellen]]></category>
		<guid isPermaLink="false">https://robbelroot.de/?p=5344</guid>

					<description><![CDATA[<p>Excel online Du möchtest das weltbekannte Excel online verwenden und Office damit sogar kostenlos in der Cloud nutzen? Arbeite mit den Office wie Excel und Word im Web sowie aus dem Windows-Store als installierte Apps – teils kostenlos! Vielleicht zieht Dich Dein Interesse auch noch zu folgenden Beiträgen: Serienbrief mit &#8230;</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/excel-online/">Excel online</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Online.png"><img loading="lazy" decoding="async" width="1200" height="628" src="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Online.png" alt="Excel Online" class="wp-image-5348" title="Excel Online"/></a><figcaption>Excel Online</figcaption></figure>






<h2 class="wp-block-heading">Excel online</h2>



<p>Du <strong>möchtest </strong>das weltbekannte <strong>Excel online</strong> verwenden <strong>und </strong>Office damit sogar kostenlos in der <strong>Cloud </strong>nutzen?</p>



<p><strong>Arbeite </strong>mit den <strong>Office </strong>wie <strong>Excel </strong>und <strong>Word </strong>im <strong>Web </strong>sowie aus dem <strong>Windows-Store</strong> als installierte Apps – teils <strong>kostenlos</strong>!</p>



<p id="serienbrief-mit-excel"><strong>Vielleicht </strong>zieht Dich Dein <strong>Interesse auch </strong>noch zu <strong>folgenden Beiträgen</strong>: <strong><a href="https://robbelroot.de/blog/serienbrief-excel/" target="_blank" rel="noreferrer noopener">Serienbrief mit Excel</a></strong>, <strong><a href="https://robbelroot.de/blog/excel-kalenderwoche/" target="_blank" rel="noreferrer noopener">Excel Kalenderwoche</a></strong>, <strong><a href="https://robbelroot.de/blog/excel-makro-erstellen/" target="_blank" rel="noreferrer noopener">Makro in Excel erstellen</a></strong>.</p>



<h2 class="wp-block-heading">Das Office Monopol</h2>



<p><strong>Wer kennt </strong>es <strong>nicht</strong>, das <strong>täglich </strong>genutzte <strong>Office Monopol</strong>, bestehend aus <strong>Word</strong>, <strong>Excel</strong>, <strong>Outlook </strong>und <strong>Powerpoint</strong>?</p>



<p>Ob im <strong>privaten</strong>, oder <strong>beruflichen Büro</strong>, ob <strong>Projektplanung</strong>, oder <strong>Kundenmanagement </strong>– <strong><a href="https://de.wikipedia.org/wiki/Microsoft_Office" target="_blank" rel="noreferrer noopener">Microsoft Office</a> </strong>ist überall vertreten.</p>



<p><strong>Besonders <a href="https://de.wikipedia.org/wiki/Microsoft_Excel" target="_blank" rel="noreferrer noopener">Excel</a> </strong>wird im <strong>gewerblichen Bereich </strong>häufig für die <strong>interne Planung </strong>und – im wahrsten Sinne des Wortes – (Tabellen)<strong>Kalkulation </strong>verwendet.</p>



<h3 class="wp-block-heading">Links</h3>



<p><strong>Hier </strong>findest Du <strong>Links zu Amazon</strong>, wo Du ein *<strong>Microsoft Office 365 Single, sowie Family Abonnement</strong> erwerben kannst.</p>



<p>Zur <strong>Zeit </strong>der <strong>Erstellung </strong>dieses Beitrages <strong>waren </strong>Diese Produkte sogar <strong>im Angebot</strong>!</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<h3 class="wp-block-heading">Microsoft 365 Single</h3>



<a href="https://www.amazon.de/Microsoft-Single-Mehrere-Tablets-Jahresabonnement/dp/B086QBLNVZ?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;dchild=1&amp;keywords=office%2B365&amp;qid=1628860892&amp;sr=8-4&amp;th=1&amp;linkCode=li3&amp;tag=robbetutor-21&amp;linkId=3f0ff0e535cfd495c4ab6f7f388001ec&amp;language=de_DE&amp;ref_=as_li_ss_il" target="_blank" rel="noopener"><img decoding="async" border="0" src="//ws-eu.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;ASIN=B086QBLNVZ&amp;Format=_SL250_&amp;ID=AsinImage&amp;MarketPlace=DE&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=robbetutor-21&amp;language=de_DE"></a><img loading="lazy" decoding="async" src="https://ir-de.amazon-adsystem.com/e/ir?t=robbetutor-21&amp;language=de_DE&amp;l=li3&amp;o=3&amp;a=B086QBLNVZ" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;">
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<h3 class="wp-block-heading"> Microsoft 365 Family</h3>



<a href="https://www.amazon.de/Microsoft-multilingual-Mehrere-Jahresabonnement-Download/dp/B00B4142MQ?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;dchild=1&amp;keywords=office+365&amp;qid=1628860892&amp;sr=8-3&amp;linkCode=li3&amp;tag=robbetutor-21&amp;linkId=e84fac72606124a67f4422d3f62d18f8&amp;language=de_DE&amp;ref_=as_li_ss_il" target="_blank" rel="noopener"><img decoding="async" border="0" src="//ws-eu.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;ASIN=B00B4142MQ&amp;Format=_SL250_&amp;ID=AsinImage&amp;MarketPlace=DE&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=robbetutor-21&amp;language=de_DE"></a><img loading="lazy" decoding="async" src="https://ir-de.amazon-adsystem.com/e/ir?t=robbetutor-21&amp;language=de_DE&amp;l=li3&amp;o=3&amp;a=B00B4142MQ" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;">
</div>
</div>



<p><sub>* es handelt sich bei den Links um sogenannte Affiliate-Links. Die erworbenen Produkte sind für Dich keinen Cent teurer. Du unterstützt mich mit dem Erwerb über die gegebenen Links, indem ich eine kleine Provision von Amazon erhalte.</sub></p>



<h3 class="wp-block-heading">Excel – Tabellenkalkulation (Excel online weiter unten)</h3>



<figure class="wp-block-image size-full is-resized"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel.png"><img loading="lazy" decoding="async" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel.png" alt="Microsoft Excel" class="wp-image-5357" width="320" height="167" title="Microsoft Excel"/></a><figcaption>Microsoft Excel</figcaption></figure>



<p><strong>Excel </strong>ist eines der, bzw. schon fast DAS <strong>Flaggschiff </strong>der <strong>Microsoft Office Produkte</strong>.</p>



<p><strong>Eingegebene Daten </strong>können <strong>zentral </strong>gespeichert, <strong>sortiert </strong>und <strong>verarbeitet </strong>werden.</p>



<p>Nach der <strong>Aufbereitung </strong>der <strong>Daten</strong>, können Sie <strong>visualisiert </strong>und so dem <strong>Nutzer </strong>passender <strong>dargestellt </strong>werden.</p>



<p><strong>Natürlich </strong>ersetzt <strong>Excel </strong>und auch die <strong>anderen Office </strong>Produkte kein vollständiges CRM – so meine Meinung – aber dennoch, kommt man <strong>nah ran</strong>.</p>



<h3 class="wp-block-heading">Word – Schreibarbeit</h3>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Word.png"><img loading="lazy" decoding="async" width="320" height="167" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Word.png" alt="Microsoft Word" class="wp-image-5360" title="Microsoft Word"/></a><figcaption>Microsoft Word</figcaption></figure>



<p>Wer beim <strong>Aufsetzen </strong>der <strong>Briefe </strong>den Überblick und die Funktionalität der gefühlten zig tausend Normen im Blick behalten möchte, nutzt <strong>Microsoft Word</strong>.</p>



<p><strong>Dokumentationen</strong>, <strong>Bewerbungen </strong>oder sonstige <strong>formelle und non-formelle Schreiben </strong>werden im so gut wie bekanntesten <strong>Schreibprogramm </strong>getätigt.</p>



<p><strong>Durch </strong>die <strong>breite Streuung </strong>der <strong>Verwendungsfälle</strong>, aber auch durch <strong>kostenlose Alternativen </strong>lassen sich geschriebene <strong>Dokumente </strong>einfach bearbeiten.</p>



<h3 class="wp-block-heading">Powerpoint – Präsentationen</h3>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Powerpoint.png"><img loading="lazy" decoding="async" width="320" height="167" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Powerpoint.png" alt="Microsoft Powerpoint" class="wp-image-5365" title="Microsoft Powerpoint"/></a><figcaption>Microsoft Powerpoint</figcaption></figure>



<p><strong>Powerpoint </strong>ist das wohl <strong>meist genutzte Programm </strong>wenn es um das <strong>Thema </strong>&#8222;etwas präsentieren&#8220;, bzw. <strong>Präsentationen </strong>geht.</p>



<p>&#8222;<strong>Warum </strong>unser <strong>Produkt </strong>das <strong>Beste </strong>ist&#8220;, &#8222;<strong>Warum </strong>Sie gerade <strong>mich für </strong>den <strong>Job </strong>nehmen sollten&#8220; und <strong>viele </strong>andere <strong>Fragen </strong>werden <strong>unterstützend </strong>durch <strong>Präsentationen </strong>geklärt.</p>



<p><strong>Basierend </strong>auf <strong>Folien </strong>arbeitet das moderne <strong>Powerpoint </strong>mit vielen schönen Mitteln, wie z. B. <strong>animierte Übergänge</strong>.</p>



<h3 class="wp-block-heading">Outlook – Mailing</h3>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Outlook.png"><img loading="lazy" decoding="async" width="320" height="167" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Outlook.png" alt="Microsoft Outlook" class="wp-image-5363" title="Microsoft Outlook"/></a><figcaption>Microsoft Outlook</figcaption></figure>



<p>Im <strong>Zeitalter </strong>der digitalen Kommunikation darf <strong>neben Whatsapp </strong>&amp; Co. auch das <strong>Thema Email </strong>nicht fehlen, bzw. zu kurz kommen.</p>



<p><strong>Während </strong>die <strong>normalen Messenger </strong>eher für <strong>zwischendurch </strong>genutzt werden, tritt <strong>Outlook </strong>hingegen in die <strong>Rolle </strong>des <strong>digitalen Briefkasten</strong>.</p>



<p><strong>Emails verfassen </strong>und <strong>stylen</strong>, ggf. noch eine <strong>Signatur </strong>hinzufügen und schon steht alles für eine <strong>professionelle</strong>, <strong>digitale Kommunikation</strong>.</p>



<h2 class="wp-block-heading">Online – Office Produkte, darunter auch Excel online</h2>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Office-online.png"><img loading="lazy" decoding="async" width="533" height="436" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Office-online.png" alt="Microsoft Office online" class="wp-image-5382" title="Microsoft Office online"/></a><figcaption>Microsoft Office online</figcaption></figure>



<p>Im <strong>heutigen </strong>Cloud-<strong>Zeitalter </strong>dauerte es bei vielen Herstellern nicht lang, bis auch Diese <strong>auf </strong>den <strong>Cloud-Zug</strong> <strong>aufgesprungen </strong>waren.</p>



<p>Microsoft hat hier zum <strong>Beispiel auch </strong>eine <strong>Lösung unter </strong>der Adresse <strong><a href="https://www.office.com" target="_blank" rel="noreferrer noopener">www.office.com</a></strong> eingerichtet.</p>



<p>Nachdem man sich mit seinem <strong>Microsoft-Konto</strong> angemeldet, oder bei Bedarf registriert hat, kann man <strong>viele Funktionen </strong>der Office-Familie <strong>kostenlos</strong> nutzen.</p>



<h2 class="wp-block-heading">Unterschiede</h2>



<p><strong>Funktionen </strong>wie der <strong><a href="#serienbrief-mit-excel">oben bereits verlinkte Serienbrief</a></strong>, habe ich <strong>dort </strong>zum Zeitpunkt des Beitrages allerdings <strong>nicht gefunden</strong>.</p>



<p>Ich denke, dass <strong>Microsoft </strong>mit den <strong>kostenlosen Produkten </strong>eine gewisse <strong>kostenlose Basis </strong>vor allem <strong>analog </strong>zur <strong>Konkurrenz </strong>wie <strong>Google </strong>schaffen wollte.</p>



<p><strong>Wichtige</strong>, bzw. – man könnte sagen – <strong>kommerzieller </strong>ausgerichtete <strong>Funktionen </strong>wird man dennoch nur in den <strong>Vollversionen </strong>finden.</p>



<p><strong>Weitere Hilfe </strong>zum Thema <strong>Unterschiede </strong>findest Du zum Beispiel noch in der <strong><a href="https://support.microsoft.com/de-de/office/was-ist-der-unterschied-zwischen-microsoft-365-und-office-2019-ed447ebf-6060-46f9-9e90-a239bd27eb96" target="_blank" rel="noreferrer noopener">Dokumentation von Microsoft</a></strong> und <strong><a href="https://www.microsoft.com/de-de/microsoft-365/free-office-online-for-the-web" target="_blank" rel="noreferrer noopener">hier</a></strong>.</p>



<h2 class="wp-block-heading">Unterschätzte Produkte</h2>



<p><strong>Neben </strong>den wohl für <strong>fast jeden</strong> Menschen <strong>bekannten Produkten</strong>, gibt es allerdings noch <strong>weitere Highlights</strong>.</p>



<p>Diese <strong>sind neben </strong>den tollen <strong>Funktionalitäten teils </strong>sogar <strong>kostenlos </strong>und <strong>analog </strong>zu ihrer eventuell vorhandenen &#8222;Unbekanntheit&#8220; auch <strong>unterschätzt</strong>.</p>



<p><strong>Besonders zwei </strong>dieser Apps <strong>nutze ich </strong>z. B. <strong>regelmäßig </strong>im Office-Gebrauch und würde darauf <strong>ungern verzichten</strong>.</p>



<p><strong>Natürlich </strong>gibt es <strong>auch hier </strong>wieder <strong>Konkurrenz </strong>von Anbietern wie Google und Co., <strong>allerdings schadet </strong>es ja <strong>nicht</strong>, sich vielleicht auch mal <strong>beides anzuschauen</strong>.</p>



<h3 class="wp-block-heading">Microsoft Whiteboard</h3>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/11/Microsoft-Whiteboard-Chip.de_.jpg"><img loading="lazy" decoding="async" width="999" height="641" src="https://robbelroot.de/wp-content/uploads/2021/11/Microsoft-Whiteboard-Chip.de_.jpg" alt="Microsoft Whiteboard" class="wp-image-6653" title="Microsoft Whiteboard"/></a><figcaption>Microsoft Whiteboard – Bild-Quelle: Chip.de</figcaption></figure>



<p><strong>Das erste </strong>meiner Meinung nach <strong>unterschätzte </strong>und eventuell zu unbekannte <strong>Tool </strong>ist &#8222;Microsoft Whiteboard&#8220;.</p>



<p>Mit <strong>Microsoft Whiteboard </strong>kann man – wie der Name schon vermuten lässt –, <strong>wie auf </strong>einem <strong>Whiteboard arbeiten</strong>.</p>



<p><strong>Dabei</strong> kann man gemeinsam <strong>mit Teampartnern </strong>arbeiten und <strong>zum Beispiel </strong>auch den <strong>PC </strong>in Kombination <strong>mit </strong>einem <strong>iPad nutzen </strong>(wie ich).</p>



<p>Ich <strong>denke </strong>ich werde <strong>darauf </strong>noch <strong>genauer in </strong>einem <strong>zukünftigen </strong>Beitrag <strong>eingehen </strong>und dessen Features genauer erklären.</p>



<p>Besuche gerne die offizielle Seite des <strong><a href="https://www.microsoft.com/de-de/microsoft-365/microsoft-whiteboard/digital-whiteboard-app" target="_blank" rel="noreferrer noopener">Microsoft Whiteboard </a></strong>und lade Dir die Software einmal herunter.</p>



<p><strong>Alternativ </strong>(und wie im Bild zu erkennen), gibt es auch die <strong>Möglichkeit</strong>, das Microsoft Whiteboard <strong>online </strong>zu <strong>verwenden</strong>.</p>



<h3 class="wp-block-heading">Microsoft OneNote</h3>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/11/Microsoft-OneNote-App.png"><img loading="lazy" decoding="async" width="768" height="412" src="https://robbelroot.de/wp-content/uploads/2021/11/Microsoft-OneNote-App.png" alt="Microsoft OneNote App" class="wp-image-6659" title="Microsoft OneNote App"/></a><figcaption>Microsoft OneNote App – Bild-Quelle: Microsoft.de</figcaption></figure>



<p>Das <strong>zweite </strong>und nächste <strong>Tool</strong>, Welches meiner Meinung nach <strong>mehr Aufmerksamkeit </strong>bekommen dürfte/sollte ist <strong><a href="https://www.microsoft.com/de-de/microsoft-365/onenote/digital-note-taking-app" target="_blank" rel="noreferrer noopener">Microsoft OneNote</a></strong>.</p>



<p><strong>Microsoft selbst beschreibt </strong>die OneNote-App kurzum <strong>als </strong>&#8222;<strong>digitales Notizbuch</strong>&#8222;, weitergehend mit: &#8222;Ein Notizbuch für vielfältige Einsatzbereiche und Anforderunge&#8220;.</p>



<p>Dem <strong>kann ich </strong>selbst nur <strong>zustimmen</strong>, früher habe ich z. B. <strong><a href="https://evernote.com/intl/de" target="_blank" rel="noreferrer noopener">Evernote</a></strong> genutzt, was mir auch bis heute irgendwie leichter von der Hand geht.</p>



<p><strong>Allerdings </strong>kann ich nur sagen, dass man dem <strong>OneNote-Tool</strong> definitiv eine Chance geben sollte, falls man <strong>auf </strong>der <strong>Suche nach </strong>einer <strong>digitalen Notiz-App</strong> ist.</p>



<p><strong>Auch hier </strong>werde ich <strong>ggf</strong>. in zukünftigen Beiträgen <strong>noch </strong>genauer <strong>eingehen</strong>!</p>



<h2 class="wp-block-heading">Weiterführende Links</h2>



<ul class="wp-block-list"><li><strong><a href="https://robbelroot.de/blog/excel-viewer/">Excel Viewer</a></strong> von Microsoft</li><li><strong><a href="https://robbelroot.de/blog/excel-kalenderwoche/" target="_blank" rel="noreferrer noopener">Excel Kalenderwoche</a></strong> ermitteln</li><li><a href="https://robbelroot.de/blog/serienbrief-excel/" target="_blank" rel="noreferrer noopener"><strong>Serienbrief in Excel erstellen</strong></a></li></ul>
<p>Der Beitrag <a href="https://robbelroot.de/blog/excel-online/">Excel online</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://robbelroot.de/blog/excel-online/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>VBA in Excel öffnen</title>
		<link>https://robbelroot.de/blog/vba-in-excel-oeffnen/</link>
					<comments>https://robbelroot.de/blog/vba-in-excel-oeffnen/#comments</comments>
		
		<dc:creator><![CDATA[Robert Skibbe]]></dc:creator>
		<pubDate>Tue, 10 Aug 2021 06:57:30 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Visual Basic for Applications]]></category>
		<category><![CDATA[Visual Basic for Applications lernen]]></category>
		<category><![CDATA[arbeitsblatt]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[erstellen]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[kalkulation]]></category>
		<category><![CDATA[machen]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[öffnen]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[sheet]]></category>
		<category><![CDATA[tabelle]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[visual basic]]></category>
		<category><![CDATA[visual basic for applications]]></category>
		<category><![CDATA[worksheet]]></category>
		<guid isPermaLink="false">https://robbelroot.de/?p=5233</guid>

					<description><![CDATA[<p>VBA in Excel öffnen Du möchtest VBA in Excel öffnen und mit der Programmierung von Excel-Hilfsmitteln durch Visual Basic for Applications loslegen? Erfahre in meinem heutigen Beitrag, wie Du einfach und schnell durchstarten kannst! Vielleicht schwenkt Dein Interesse nach diesem Beitrag noch auf folgende ähnliche Beiträge: IFS VBA, VBA For &#8230;</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/vba-in-excel-oeffnen/">VBA in Excel öffnen</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><a href="https://robbelroot.de/wp-content/uploads/2021/08/VBA-in-Excel-oeffnen.png"><img loading="lazy" decoding="async" width="1024" height="536" src="https://robbelroot.de/wp-content/uploads/2021/08/VBA-in-Excel-oeffnen-1024x536.png" alt="VBA in Excel öffnen" class="wp-image-5237" title="VBA in Excel öffnen" srcset="https://robbelroot.de/wp-content/uploads/2021/08/VBA-in-Excel-oeffnen-1024x536.png 1024w, https://robbelroot.de/wp-content/uploads/2021/08/VBA-in-Excel-oeffnen-300x157.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/VBA-in-Excel-oeffnen-768x402.png 768w, https://robbelroot.de/wp-content/uploads/2021/08/VBA-in-Excel-oeffnen-700x366.png 700w, https://robbelroot.de/wp-content/uploads/2021/08/VBA-in-Excel-oeffnen-332x174.png 332w, https://robbelroot.de/wp-content/uploads/2021/08/VBA-in-Excel-oeffnen.png 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption>VBA in Excel öffnen</figcaption></figure>






<h2 class="wp-block-heading">VBA in Excel öffnen</h2>



<p>Du möchtest <strong>VBA in Excel öffnen</strong> und mit der <strong>Programmierung </strong>von Excel-Hilfsmitteln durch <strong>Visual Basic for Applications</strong> loslegen?</p>



<p><strong>Erfahre </strong>in meinem heutigen Beitrag, <strong>wie </strong>Du <strong>einfach </strong>und <strong>schnell </strong>durchstarten kannst!</p>



<p>Vielleicht schwenkt Dein Interesse nach diesem Beitrag noch auf folgende <strong>ähnliche Beiträge</strong>: <strong><a href="https://robbelroot.de/blog/ifs-vba/" target="_blank" rel="noreferrer noopener">IFS VBA</a></strong>, <strong><a href="https://robbelroot.de/blog/vba-for-schleife/" target="_blank" rel="noreferrer noopener">VBA For Schleife</a></strong>, <strong><a href="https://robbelroot.de/blog/vba-instr/" target="_blank" rel="noreferrer noopener">InStr</a></strong>.</p>



<h2 class="wp-block-heading">Was ist VBA?</h2>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/vba-kreis-logo.png"><img loading="lazy" decoding="async" width="256" height="256" src="https://robbelroot.de/wp-content/uploads/2021/08/vba-kreis-logo.png" alt="Excel VBA Kreis Logo" class="wp-image-5248" title="Excel VBA Kreis Logo" srcset="https://robbelroot.de/wp-content/uploads/2021/08/vba-kreis-logo.png 256w, https://robbelroot.de/wp-content/uploads/2021/08/vba-kreis-logo-150x150.png 150w" sizes="auto, (max-width: 256px) 100vw, 256px" /></a></figure>



<p><strong>Bevor </strong>wir uns <strong>mit </strong>dem <strong>Kern beschäftigen</strong>, also wie wir <strong>VBA in Excel öffnen</strong> können, <strong>schauen </strong>wir uns einmal genauer an <strong>was VBA überhaupt ist</strong>.</p>



<p><strong>Falls </strong>Du frei nach dem Motto &#8222;<strong>TL;DR;</strong> (Too Long Didn&#8217;t Read)&#8220; <strong>direkt </strong>zum Ort des Geschehens <strong>hüpfen </strong>möchtest, <strong>scrolle </strong>einfach ein wenig <strong>runter</strong>.</p>



<p>Ich <strong>denke </strong>allerdings, dass vor allem <strong>Anfänger </strong>sich die obige <strong>Frage stellen </strong>und sich ein wenig Einführung, bzw. <strong>Wiederholung</strong> <strong>nicht schaden </strong>kann.</p>



<h2 class="wp-block-heading">Microsoft Excel</h2>



<p>Wenn man an <strong>Bürojobs aus</strong> fast <strong>egal welcher Branche </strong>denkt, denkt man <strong>meistens auch </strong>an die <strong><a href="https://de.wikipedia.org/wiki/Microsoft_Office" target="_blank" rel="noreferrer noopener">Office-Produktfamilie</a></strong> von Microsoft.</p>



<p>In <strong>so gut wie</strong> jeder ausgeschriebenen <strong>Stellenanzeige </strong>werden zumindest <strong>Grundkenntnisse </strong>erwartet, da Sie ein elementarer <strong>Grundbaustein sind</strong>.</p>



<p>Egal ob im Bereich Transporte, Network-Marketing, oder sonst irgendwo, <strong>fast überall </strong>sind die bekannten Office-Produkte wie <strong>Word, Excel und Outlook</strong> im Einsatz.</p>



<p><strong>Häufig </strong>gibt es allerdings <strong>Aufgaben </strong>und bestimmte <strong>Einsatzfelder</strong>, wo diverse <strong>Tätigkeiten wiederholt </strong>werden müssen.</p>



<p><strong>Ebenso </strong>saß man als Nutzer der Produkte vermutlich schon <strong>selbst an </strong>dem <strong>Punkt</strong>, wo man <strong>gerne </strong>die eine oder andere <strong>Funktion mehr </strong>gehabt hätte.</p>



<h2 class="wp-block-heading">VBA zur Rettung</h2>



<p><strong>Genau </strong>an dieser im vorherigen Abschnitt <strong>erwähnten Stelle kommt </strong>dann <strong><a href="https://de.wikipedia.org/wiki/Visual_Basic_for_Applications" target="_blank" rel="noreferrer noopener">Visual Basic for Applications</a></strong> – oder kurz <strong>VBA </strong>– ins Spiel.</p>



<p>Was <strong>im ersten Moment </strong>eventuell wie ein <strong>Werkzeug </strong>zum <strong>Zeichnen </strong>o. Ä. klingt, <strong>ist </strong>in Wahrheit <strong>eine Skriptsprache</strong>.</p>



<p><strong>Wie </strong>der <strong>Name </strong>auch schon ggf. <strong>vermuten lässt</strong>, ist Diese <strong>auf </strong>die <strong>Verwendung innerhalb </strong>von bestehenden <strong>Anwendungen </strong>konzipiert.</p>



<p><strong>Um genau </strong>zu sein handelt es sich bei diesen <strong>Anwendungen exakt </strong>um die <strong>vorher angesprochenen Produkte </strong>wie Word, <strong>Excel </strong>und Co.</p>



<p>Wir <strong>können </strong>mit<strong> VBA </strong>die <strong>vorhandenen Funktionalitäten </strong>der einzelnen Programme <strong>erweitern und </strong>uns so eine <strong>individuell </strong>größere Palette an <strong>Werkzeugen </strong>bauen.</p>



<p>So hat <strong>jeder VBA-Nutzer</strong> die Möglichkeit, sich seine ein wenig mehr auf sich <strong>zurechtgeschnittene Arbeitsumgebung </strong>zu <strong>schaffen</strong>.</p>



<p><strong>Dabei </strong>ist es besonders <strong>toll</strong>, dass <strong>durch </strong>diverse <strong>Funktionen wie </strong>z. B. das <strong>Aufnehmen von <a href="https://de.wikipedia.org/wiki/Makro" target="_blank" rel="noreferrer noopener">Makros</a></strong>, nicht zwangsweise <strong>Programmierkenntnisse </strong>notwendig sind.</p>



<p><strong>Natürlich </strong>sind Diese jedoch <strong>von Vorteil </strong>und vereinfachen Vieles, wie die Anpassung und <strong>Erweiterung </strong>der Skripte, usw.</p>



<h2 class="wp-block-heading">VBA in Excel öffnen – Das Beispiel</h2>



<p><strong>Letztendlich </strong>kann man <strong>VBA</strong>, bzw. genauer genommen den <strong>VBA-Editor in Excel</strong> auf unterschiedliche Wege <strong>öffnen</strong>.</p>



<p>Am einfachsten ist es, wenn man die <strong>Tastenkombination [ALT]-[F11]</strong> verwendet, <strong>um </strong>den <strong>VBA-Editor</strong> zu <strong>öffnen</strong>.</p>



<pre class="wp-block-verse"><strong>Achtung!</strong> Je nach Version des jeweiligen Programmes (Word, Excel, Outlook..), kann es <strong>kleine Unterschiede </strong>geben!</pre>



<p><strong>Eventuell </strong>musst Du vor dem Öffnen des Editors <strong>auch bereits </strong>ein <strong>Dokument</strong>, bzw. eine <strong>Tabelle geöffnet </strong>haben.</p>



<p><strong>Über </strong>die <strong>grafische Oberfläche </strong>kannst Du zumeist auch die <strong>Schritte über </strong>das <strong>Menüband </strong>gehen.</p>



<h2 class="wp-block-heading">Wenn es nicht funktioniert</h2>



<p><strong>Falls </strong>Du mit den hier drüber genannten Schritten <strong>nicht weiterkommst</strong>, kannst Du <strong>überprüfen</strong>, <strong>ob </strong>Dir die <strong>Sicherheitseinstellungen </strong>im Weg sind.</p>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen.png"><img loading="lazy" decoding="async" width="657" height="426" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen.png" alt="Microsoft Excel Optionen öffnen" class="wp-image-5217" title="Microsoft Excel Optionen öffnen" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen.png 657w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen-300x195.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen-332x215.png 332w" sizes="auto, (max-width: 657px) 100vw, 657px" /></a><figcaption>Microsoft Excel Optionen öffnen</figcaption></figure>



<p><strong>Gehe </strong>dazu am besten einmal <strong>in </strong>die <strong>Optionen </strong>deines <strong>Programmes </strong>und <strong>überprüfe </strong>den <strong>Punkt </strong>&#8222;<strong>Trust Center</strong>&#8222;, bzw. &#8222;<strong>Sicherheitseinstellungen</strong>&#8222;.</p>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen.png"><img loading="lazy" decoding="async" width="781" height="297" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen.png" alt="Microsoft-Excel-Makroeinstellungen" class="wp-image-5221" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen.png 781w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen-300x114.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen-768x292.png 768w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen-700x266.png 700w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen-332x126.png 332w" sizes="auto, (max-width: 781px) 100vw, 781px" /></a><figcaption>Microsoft-Excel-Makroeinstellungen</figcaption></figure>



<p><strong>Dort </strong>findest Du eventuell <strong>mehr Informationen </strong>zum Thema <strong>Entwicklertools </strong>– worum es sich bei VBA ja handelt.</p>



<p>In den <strong>Optionen </strong>hast Du die <strong>Möglichkeit</strong>, die <strong>Entwicklertools </strong>zum <strong>Menüband hinzuzufügen</strong>, sowie <strong>Einstellungen </strong>zu <strong>Makros</strong>, etc. zu treffen.</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/vba-in-excel-oeffnen/">VBA in Excel öffnen</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://robbelroot.de/blog/vba-in-excel-oeffnen/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Excel Makro erstellen</title>
		<link>https://robbelroot.de/blog/excel-makro-erstellen/</link>
					<comments>https://robbelroot.de/blog/excel-makro-erstellen/#comments</comments>
		
		<dc:creator><![CDATA[Robert Skibbe]]></dc:creator>
		<pubDate>Mon, 09 Aug 2021 23:32:56 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Visual Basic for Applications]]></category>
		<category><![CDATA[Visual Basic for Applications Problemlösungen]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[aufzeichnen]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[cell]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[erstellen]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[kalkulation]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[makro]]></category>
		<category><![CDATA[neu]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[record]]></category>
		<category><![CDATA[recording]]></category>
		<category><![CDATA[row]]></category>
		<category><![CDATA[spalte]]></category>
		<category><![CDATA[tabelle]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[visual]]></category>
		<category><![CDATA[visual basic for applications]]></category>
		<category><![CDATA[xls]]></category>
		<category><![CDATA[xlsm]]></category>
		<category><![CDATA[zeile]]></category>
		<category><![CDATA[zelle]]></category>
		<guid isPermaLink="false">https://robbelroot.de/?p=5200</guid>

					<description><![CDATA[<p>Excel Makro erstellen Ein Excel Makro erstellen und damit eventuell deine Arbeit zu erleichtern, bzw. zu automatisieren ist Dein Ziel? Dann ist es schön, dass Du auf dem Weg deiner Recherche zu meinem heutigen Beitrag gefunden hast, denn genau darum geht es heute! Schaue gerne alternativ auch bei meinen anderen &#8230;</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/excel-makro-erstellen/">Excel Makro erstellen</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-erstellen.png"><img loading="lazy" decoding="async" width="1024" height="536" src="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-erstellen-1024x536.png" alt="Excel Makro erstellen" class="wp-image-5202" title="Excel Makro erstellen" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-erstellen-1024x536.png 1024w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-erstellen-300x157.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-erstellen-768x402.png 768w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-erstellen-700x366.png 700w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-erstellen-332x174.png 332w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-erstellen.png 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption>Excel Makro erstellen</figcaption></figure>






<h2 class="wp-block-heading">Excel Makro erstellen</h2>



<p>Ein <strong>Excel Makro erstellen</strong> <strong>und </strong>damit eventuell deine <strong>Arbeit</strong> zu <strong>erleichtern</strong>, bzw. zu <strong>automatisieren </strong>ist Dein <strong>Ziel</strong>?</p>



<p><strong>Dann </strong>ist es schön, dass Du auf dem Weg <strong>deiner Recherche</strong> zu meinem <strong>heutigen Beitrag </strong>gefunden hast, denn genau darum <strong>geht es </strong>heute!</p>



<p><strong>Schaue </strong>gerne <strong>alternativ </strong>auch bei meinen anderen <strong>VBA </strong>Excel <strong>Beiträgen </strong>wie: <strong><a href="https://robbelroot.de/blog/excel-makro-button/" target="_blank" rel="noreferrer noopener">Excel Makro Button</a></strong>, <strong><a href="https://robbelroot.de/blog/vba-for-schleife/" target="_blank" rel="noreferrer noopener">VBA For Schleife</a></strong> &amp; <strong><a href="https://robbelroot.de/blog/vba-range/" target="_blank" rel="noreferrer noopener">Range VBA</a></strong> vorbei.</p>



<h2 class="wp-block-heading">Was ist eigentlich ein Makro?</h2>



<p><strong>Ganz nach </strong>dem Motto &#8222;<strong>Back To The Roots</strong>&#8220; schauen wir uns erstmal die <strong>Bedeutung eines Makros </strong>an und <strong>wofür </strong>man es letztendlich <strong>verwendet</strong>.</p>



<p><strong>Makros </strong>sind <strong>vor allem </strong>im Bereich der <strong>Automatisierung </strong>von diversen <strong>Prozessen </strong>nicht wegzudenken, denn Sie <strong>können </strong>die <strong>alltägliche Arbeit </strong>erleichtern.</p>



<p>Sie sind <strong>für </strong>die <strong>Non-Programmierer</strong> vor allem aus dem Bereich <strong>Microsoft Excel und Co</strong>. bekannt und werden dort täglich eingesetzt.</p>



<p>Ein <strong>Makro </strong>ist letztendlich nichts Anderes als eine <strong>Sammlung von Anweisungen</strong>, praktisch also <strong>ein Zettel mit</strong> &#8222;Tu dies, tu jenes und danach dies &amp; das&#8220;.</p>



<h2 class="wp-block-heading">Ein Makro auslösen</h2>



<p><strong>Bevor </strong>wir uns der <strong>Erstellung </strong>des <strong>Makros </strong>widmen, <strong>schauen </strong>wir uns <strong>nochmal kurz </strong>vorher die <strong>Möglichkeiten zur Auslösung </strong>von Makros an.</p>



<p>Dazu können wir auf eher <strong>passive Ereignisse</strong>, bzw. Trigger warten, <strong>oder </strong>die <strong>aktive</strong> Varianten wie z. B. durch einen <strong>Button</strong>&#8211;<strong>Klick</strong>, oder <strong>Hotkey </strong>wählen.:</p>



<h3 class="wp-block-heading">Varianten</h3>



<ul class="wp-block-list"><li>auslösen durch <strong>Hotkeys</strong></li><li>im <strong>Ladevorgang </strong>der <strong>Projektmappe</strong></li><li>im <strong>Code </strong>durch den Visual Basic Editor (<strong>VBE</strong>)</li><li>und <strong>mehr</strong>..</li></ul>



<p>Mit diesen <strong>Ausgangspunkten </strong>können wir uns nun <strong>im nächsten Schritt</strong>, die <strong>Erstellung </strong>eines Makros <strong>anschauen</strong>.</p>



<h2 class="wp-block-heading">Vorbereitungen – Excel Makro erstellen</h2>



<p><strong>Oft </strong>bekommt man <strong>bei </strong>der <strong>ersten Arbeit </strong>mit Makros ein <strong>kleines </strong>&#8222;<strong>Problem</strong>&#8222;, Welches aber gar kein richtiges Problem, sondern eher ein <strong>Sicherheitsfeature </strong>ist.</p>



<p><strong>Zumeist </strong>ist die <strong>Verwendung</strong> <strong>von Makros </strong>in Microsoft Excel Tabellen <strong>standardmäßig </strong>mehr oder weniger <strong>deaktiviert</strong>.</p>



<p>Wir <strong>müssen </strong>die mögliche <strong>Nutzung von Makros </strong>also erstmal aktivieren und das machen wir <strong>über die Optionen</strong>.</p>



<h3 class="wp-block-heading">Makros aktivieren</h3>



<p><strong>Begebe </strong>Dich also <strong>nun </strong>unter den Punkt <strong>Datei->Optionen</strong> in die <strong>Optionen von Excel</strong>.</p>



<pre class="wp-block-verse"><strong>Achtung!</strong> Deine Optionen <strong>sehen eventuell anders aus</strong>, bei mir werden durch die <strong>Verwendung </strong>von <strong>Web-Office</strong> aktuell nur <strong>diese Optionen</strong> angezeigt.</pre>



<h4 class="wp-block-heading">Excel Optionen öffnen </h4>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen.png"><img loading="lazy" decoding="async" width="657" height="426" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen.png" alt="Microsoft Excel Optionen öffnen" class="wp-image-5217" title="Microsoft Excel Optionen öffnen" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen.png 657w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen-300x195.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Optionen-oeffnen-332x215.png 332w" sizes="auto, (max-width: 657px) 100vw, 657px" /></a><figcaption>Microsoft Excel Optionen öffnen</figcaption></figure>



<h4 class="wp-block-heading">Trust-Center &amp; Einstellungen öffnen</h4>



<p>Gehe anschließend auf den Punkt &#8222;Trust-Center&#8220;, oder manchmal auch &#8222;Sicherheitseinstellungen&#8220; genannt.</p>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Trust-Center-Einstellungen.png"><img loading="lazy" decoding="async" width="694" height="290" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Trust-Center-Einstellungen.png" alt="Microsoft Excel Trust Center Einstellungen" class="wp-image-5220" title="Microsoft Excel Trust Center Einstellungen" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Trust-Center-Einstellungen.png 694w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Trust-Center-Einstellungen-300x125.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Trust-Center-Einstellungen-332x139.png 332w" sizes="auto, (max-width: 694px) 100vw, 694px" /></a><figcaption>Microsoft Excel Trust Center Einstellungen</figcaption></figure>



<h4 class="wp-block-heading">Makroeinstellungen öffnen</h4>



<p>Klicke auf den farblich markierten Button und <strong>öffne </strong>somit die <strong>Einstellungen des Trust-Centers</strong>.</p>



<pre class="wp-block-verse"><strong>Beachte </strong>natürlich die <strong>Hinweise </strong>hinter den einzelnen Optionen und <strong>öffne nur </strong>Dateien, dessen <strong>Absender </strong>Du <strong>kennst</strong>, bzw. <strong>vertraust</strong>!</pre>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen.png"><img loading="lazy" decoding="async" width="781" height="297" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen.png" alt="Microsoft Excel Makroeinstellungen" class="wp-image-5221" title="Microsoft Excel Makroeinstellungen" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen.png 781w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen-300x114.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen-768x292.png 768w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen-700x266.png 700w, https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-Makroeinstellungen-332x126.png 332w" sizes="auto, (max-width: 781px) 100vw, 781px" /></a><figcaption>Microsoft Excel Makroeinstellungen</figcaption></figure>



<p><strong>Alternativ </strong>kannst Du zur gezeigten Methode auch für <strong>jede Mappe</strong> <strong>einzeln </strong>bestimmen, <strong>ob </strong>Du dessen <strong>Makros verwenden </strong>möchtest.</p>



<p>Diese Möglichkeit bietet Dir <strong>Excel eigentlich </strong>auch von <strong>selbst </strong>an, <strong>meist mit </strong>einem kleinen <strong>Popup</strong>.</p>



<p>Allerdings kann die bei <strong>häufiger Verwendung </strong>von Makros auch <strong>nervig </strong>werden, <strong>jedoch </strong>ist es die <strong>sicherere Variante</strong>.</p>



<h3 class="wp-block-heading">Entwicklertools einbinden</h3>



<p>Mit dem <strong>nächsten Schritt</strong> würde ich Dir auch gleichzeitig ans Herz legen, die <strong>Entwicklertools </strong>in dein <strong>Menüband </strong>von Excel <strong>einzubinden</strong>.</p>



<p>Auch hier erschaffst Du Dir so einen <strong>schnellen </strong>und <strong>einfachen Zugriff </strong>auf die eventuell <strong>notwendigen Tools</strong>.</p>



<p><strong>Öffne </strong>auch hierzu wieder die <strong>Optionen </strong>von Excel und klicke links außen auf &#8222;<strong>Menüband anpassen</strong>&#8222;.</p>



<p><strong>Danach </strong>kannst Du die <strong>Entwicklertools </strong>meist <strong>mit </strong>einer <strong>Checkbox </strong>auf der <strong>rechten Seite</strong> aktivieren.</p>



<h2 class="wp-block-heading">Excel Makro erstellen – Die Praxis</h2>



<p><strong>Nachdem </strong>Du im letzten Schritt eventuell die <strong>Entwicklertools aktivierst </strong>hast, <strong>oder </strong>bereits <strong>aktiviert hattest</strong>, nutzen wir Diese auch gleich.</p>



<p><strong>Klicke </strong>dafür in deinem <strong>Menüband </strong>auf die <strong>Entwicklertools </strong>und <strong>anschließend </strong>auf die Fläche namens <strong>Makros</strong>.</p>



<p><strong>Gebe </strong>nun einen <strong>Namen </strong>für dein neues Makro <strong>ein </strong>und bestätige Diesen danach.</p>



<p>Im <strong>nächsten Schritt </strong>wird sich dadurch der <strong>VBA-Editor öffnen</strong> und schon <strong>einige Zeilen </strong>an <strong>Code</strong> zeigen.</p>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Beispiel-Makro-1.png"><img loading="lazy" decoding="async" width="982" height="781" src="https://robbelroot.de/wp-content/uploads/2021/08/Beispiel-Makro-1.png" alt="Beispiel Makro 1" class="wp-image-5231" title="Beispiel Makro 1" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Beispiel-Makro-1.png 982w, https://robbelroot.de/wp-content/uploads/2021/08/Beispiel-Makro-1-300x239.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Beispiel-Makro-1-768x611.png 768w, https://robbelroot.de/wp-content/uploads/2021/08/Beispiel-Makro-1-700x557.png 700w, https://robbelroot.de/wp-content/uploads/2021/08/Beispiel-Makro-1-332x264.png 332w" sizes="auto, (max-width: 982px) 100vw, 982px" /></a><figcaption>Beispiel Makro 1 – Quelle: Microsoft Dokumentation</figcaption></figure>



<p><strong>Hier </strong>könntest Du nun den <strong>Code deines Makros </strong>eintragen und z. B. durch:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">MsgBox("Yay, mein eigenes Makro!")</pre>



<p>eine <strong>simple Messagebox anzeigen </strong>lassen.</p>



<p><strong>Detailliertere </strong>Informationen findest Du auch in der <strong><a href="https://docs.microsoft.com/de-de/office/vba/library-reference/concepts/getting-started-with-vba-in-office" target="_blank" rel="noreferrer noopener">offiziellen Dokumentation </a></strong>von Microsoft.</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/excel-makro-erstellen/">Excel Makro erstellen</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://robbelroot.de/blog/excel-makro-erstellen/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Excel Makro Button</title>
		<link>https://robbelroot.de/blog/excel-makro-button/</link>
					<comments>https://robbelroot.de/blog/excel-makro-button/#comments</comments>
		
		<dc:creator><![CDATA[Robert Skibbe]]></dc:creator>
		<pubDate>Mon, 09 Aug 2021 16:01:21 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Visual Basic for Applications]]></category>
		<category><![CDATA[Visual Basic for Applications Problemlösungen]]></category>
		<category><![CDATA[anweisung]]></category>
		<category><![CDATA[anweisungen]]></category>
		<category><![CDATA[ausführen]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[calculation]]></category>
		<category><![CDATA[chain]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[execute]]></category>
		<category><![CDATA[kalkulation]]></category>
		<category><![CDATA[kalkulationen]]></category>
		<category><![CDATA[kette]]></category>
		<category><![CDATA[knopf]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[makro]]></category>
		<category><![CDATA[run]]></category>
		<category><![CDATA[starten]]></category>
		<category><![CDATA[tabelle]]></category>
		<category><![CDATA[tabellen]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[tables]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[visual basic]]></category>
		<guid isPermaLink="false">https://robbelroot.de/?p=5169</guid>

					<description><![CDATA[<p>Excel Makro Button Lasse mit einem Excel Makro Button eine vorgefertigte Kette von Anweisungen ausführen und deine Arbeit vereinfachen. Wie Du einen solchen Button erstellst, um ein definiertes Makro aufzurufen lernst Du in meinem heutigen Beitrag zum Thema Excel VBA. Vielleicht hast Du ja später noch Interesse an anderen Excel &#8230;</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/excel-makro-button/">Excel Makro Button</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-Button.png"><img loading="lazy" decoding="async" width="1024" height="536" src="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-Button-1024x536.png" alt="Excel Makro Button" class="wp-image-5179" title="Excel Makro Button" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-Button-1024x536.png 1024w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-Button-300x157.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-Button-768x402.png 768w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-Button-700x366.png 700w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-Button-332x174.png 332w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Makro-Button.png 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Excel Makro Button</figcaption></figure>






<h2 class="wp-block-heading">Excel Makro Button</h2>



<p>Lasse mit einem <strong>Excel Makro Button</strong> eine vorgefertigte <strong>Kette von Anweisungen</strong> <strong>ausführen </strong>und deine Arbeit vereinfachen.</p>



<p><strong>Wie </strong>Du einen <strong>solchen Button erstellst</strong>, um ein <strong>definiertes Makro aufzurufen </strong>lernst Du in meinem <strong>heutigen Beitrag </strong>zum Thema <strong>Excel VBA</strong>.</p>



<p><strong>Vielleicht </strong>hast Du ja <strong>später </strong>noch Interesse an <strong>anderen Excel VBA Beiträgen</strong>: <strong><a href="https://robbelroot.de/blog/vba-for-schleife/" target="_blank" rel="noreferrer noopener">VBA For Schleife</a></strong>, <strong><a href="https://robbelroot.de/blog/vba-msgbox/" target="_blank" rel="noreferrer noopener">MsgBox</a></strong>, <strong><a href="https://robbelroot.de/blog/vba-range/" target="_blank" rel="noreferrer noopener">Range</a></strong>.</p>



<pre class="wp-block-verse"><strong>Achtung</strong>! <strong>Bevor </strong>Du mit Makros <strong>durchstarten </strong>kannst, <strong>musst </strong>Du Sie vorher in Excel <strong>aktivieren</strong>!</pre>



<h2 class="wp-block-heading">Was sind Makros?</h2>



<p><strong>Nicht </strong>zu <strong>verwechseln mit </strong>dem slawischen, männlichen Vornamen &#8222;Marko&#8220;, <strong>ist </strong>ein <strong><a href="https://de.wikipedia.org/wiki/Makro" target="_blank" rel="noreferrer noopener">Makro</a></strong> eine <strong>Folge von Anweisungen</strong>.</p>



<p><strong>Besonders </strong>häufig, bzw. besonders <strong>beliebt </strong>sind <strong>Makros </strong>im <strong>Automatisierungsbereich </strong>in verschiedenen Kontexten.</p>



<p><strong>Speziell </strong>die <strong>Arbeit </strong>mit <strong>Tabellen </strong>aus z. B. <strong><a href="https://de.wikipedia.org/wiki/Microsoft_Excel" target="_blank" rel="noreferrer noopener">Microsoft Excel</a></strong> <strong>bietet </strong>die <strong>Erstellung </strong>und <strong>Verwendung </strong>solcher hilfreichen <strong>Makros </strong>an.</p>



<p><strong>Dabei </strong>wird dem Nutzer <strong>nicht nur </strong>vorhandene und zukünftige <strong>Arbeit abgenommen</strong>, die Arbeit kann dadurch auch wesentlich <strong>effizienter gestaltet</strong> werden!</p>



<h2 class="wp-block-heading">Makros ausführen</h2>



<p>Um bereits erstellte <strong>Makros auszuführen </strong>kannst Du <strong>verschiedene Methoden</strong> verwenden, darunter:</p>



<h3 class="wp-block-heading">Möglichkeiten</h3>



<ul class="wp-block-list">
<li>durch eine <strong>Tastenkombination</strong></li>



<li>beim <strong>Öffnen </strong>einer <strong>Projektmappe</strong></li>



<li><strong>aus </strong>dem Visual Basic Editor (<strong>VBE</strong>)</li>



<li>und <strong>mehr</strong>..</li>
</ul>



<p>In <strong>diesem</strong> <strong>Beitrag </strong>beschäftigen wir uns allerdings mit einem <strong>Button</strong>, <strong>also </strong>dem <strong>Ausführen </strong>eines <strong>Makros </strong>bei <strong>Klick auf </strong>einem Button.</p>



<h2 class="wp-block-heading">Methode 1: Button als Form einfügen</h2>



<p><strong>Damit </strong>wir einen <strong>Knopf verwenden </strong>können, um ein jeweiliges &#8222;auf Ihm&#8220; hinterlegtes <strong>Makro auszuführen</strong>, müssen wir diesen <strong>Knopf </strong>natürlich erst einmal <strong>hinzufügen</strong>.</p>



<pre class="wp-block-verse has-black-color has-text-color"><strong>Achtung!</strong> <strong>Je nach</strong> Excel <strong>Version kann </strong>sich die Menüführung <strong>unterschiedlich </strong>gestalten. Schaue auch ggf. in den <strong>Entwicklerwerkzeugen </strong>in Excel vorbei <strong>und prüfe </strong>vorher, <strong>ob </strong>du Diese <strong>aktiviert </strong>hast! Verwende für Excel-Sheets mit Makros auch die Dateiendung "<strong>.xlsm</strong>".</pre>



<h3 class="wp-block-heading">Einfügen Menü</h3>



<p>Gehe dazu in das <strong>obere Menü </strong>von Excel und <strong>suche </strong>den Punkt &#8222;<strong>Einfügen</strong>&#8222;:</p>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Menue-Einfuegen.png"><img loading="lazy" decoding="async" width="397" height="247" src="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Menue-Einfuegen.png" alt="Excel Menü Einfügen" class="wp-image-5183" title="Excel Menü Einfügen" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Excel-Menue-Einfuegen.png 397w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Menue-Einfuegen-300x187.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-Menue-Einfuegen-332x207.png 332w" sizes="auto, (max-width: 397px) 100vw, 397px" /></a><figcaption class="wp-element-caption">Excel Menü Einfügen</figcaption></figure>



<h3 class="wp-block-heading">Abgerundetes Rechteck</h3>



<p>Wähle <strong>anschließend </strong>aus, dass Du eine <strong>Form </strong>wie z. B. das <strong>abgerundete Rechteck einfügen </strong>möchtest:</p>



<pre class="wp-block-verse"><strong>Achtung! </strong>Auch hier nochmal der <strong>Hinweis </strong>auf <strong>unterschiedliche </strong>Excel-<strong>Versionen </strong>– Falls Du nicht fündig wirst, <strong>schaue </strong>doch mal <strong>ins Menü </strong>"<strong>Entwickler</strong>" (es muss erst aktiviert werden!)</pre>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-einfuegen.png"><img loading="lazy" decoding="async" width="615" height="252" src="https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-einfuegen.png" alt="Excel abgerundetes Rechteck einfügen" class="wp-image-5185" title="Excel abgerundetes Rechteck einfügen" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-einfuegen.png 615w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-einfuegen-300x123.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-einfuegen-332x136.png 332w" sizes="auto, (max-width: 615px) 100vw, 615px" /></a><figcaption class="wp-element-caption">Excel abgerundetes Rechteck einfügen</figcaption></figure>



<h3 class="wp-block-heading">Button gestalten</h3>



<p><strong>Danach </strong>kannst Du deinen <strong>Button</strong>, bzw. dein abgerundetes Rechteck so <strong>gestalten </strong>wie Du magst:</p>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-Button.png"><img loading="lazy" decoding="async" width="418" height="229" src="https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-Button.png" alt="Excel abgerundetes Rechteck Button" class="wp-image-5188" title="Excel abgerundetes Rechteck Button" srcset="https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-Button.png 418w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-Button-300x164.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/Excel-abgerundetes-Rechteck-Button-332x182.png 332w" sizes="auto, (max-width: 418px) 100vw, 418px" /></a><figcaption class="wp-element-caption">Excel abgerundetes Rechteck Button</figcaption></figure>



<h2 class="wp-block-heading">Makro an Button binden</h2>



<p>Nachdem wir im <strong>vorherigen </strong>Schritt den <strong>Button </strong>an sich mit <strong>Einfügen </strong>eines <strong>abgerundeten Rechtecks erledigt</strong> haben, können wir Diesem <strong>nun </strong>das <strong>Makro zuweisen</strong>.</p>



<p><strong>Klicke </strong>den <strong>Button </strong>dazu <strong>einfach </strong>mit der <strong>rechten Maustaste </strong>an und wähle &#8222;<strong>Makro zuweisen</strong>&#8220; – fertig!</p>



<p><strong>Nun </strong>kannst Du Dein <strong>definiertes</strong> <strong>Makro </strong>über den hinzugefügten und gestylten <strong>Button </strong>aufrufen!</p>



<h2 class="wp-block-heading">Methode 2: Schaltfläche über den Entwickler-Tab einfügen</h2>



<p>Die zweite &#8211; und oft bessere &#8211; Methode nutzt den Entwickler-Tab in Excel.<br>Damit erhältst Du eine echte Formular-Schaltfläche, bei der das Makro<br>direkt beim Erstellen zugewiesen wird.</p>



<h3 class="wp-block-heading">Schritt 1: Entwickler-Tab aktivieren</h3>



<p>Falls der Entwickler-Tab noch nicht sichtbar ist:<br>Datei → Optionen → Menüband anpassen → Entwicklertools aktivieren → OK.</p>



<h3 class="wp-block-heading">Schritt 2: Schaltfläche einfügen</h3>



<p>Wechsle in den Tab „Entwickler&#8220; und klicke auf „Einfügen&#8220;. Unter „Formularsteuerelemente&#8220; findest Du das Symbol für eine Schaltfläche (erstes Icon). Zeichne die Schaltfläche auf dem gewünschten Bereich im Sheet.</p>



<h3 class="wp-block-heading">Schritt 3: Makro direkt zuweisen</h3>



<p>Direkt nach dem Loslassen der Maus öffnet sich automatisch der Dialog &#8222;Makro zuweisen&#8220;. Wähle Dein Makro aus der Liste, oder erstelle ein neues direkt über &#8222;Neu&#8220;.</p>



<h2 class="wp-block-heading">Ein einfaches VBA-Makro als Beispiel</h2>



<p>Falls Du noch kein Makro hast, hier ein schnelles Beispiel zum Testen. Öffne den VBA-Editor mit Alt + F11, füge ein neues Modul ein und trage folgenden Code ein:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Sub MeinMakro()
    MsgBox "Makro wurde erfolgreich ausgeführt!", vbInformation, "Info"
End Sub</pre>



<p>Weise dieses Makro anschließend Deinem Button zu — fertig. Beim Klick auf den Button erscheint eine Meldung als Bestätigung.</p>



<h2 class="wp-block-heading">FAQ</h2>



<div class="schema-faq wp-block-yoast-faq-block"><div class="schema-faq-section" id="faq-question-1774458690215"><strong class="schema-faq-question"><strong>Wie erstelle ich einen Excel Makro Button?</strong></strong> <p class="schema-faq-answer">Füge über Einfügen → Formen ein abgerundetes Rechteck ein, gestalte es als Button und weise per Rechtsklick → „Makro zuweisen&#8220; ein VBA-Makro zu. Alternativ: Entwickler-Tab → Einfügen → Formular-Schaltfläche.</p> </div> <div class="schema-faq-section" id="faq-question-1774458703011"><strong class="schema-faq-question"><strong>Wo finde ich den Entwickler-Tab in Excel?</strong></strong> <p class="schema-faq-answer">Er ist standardmäßig ausgeblendet. Aktivieren über: Datei → Optionen → Menüband anpassen → Häkchen bei „Entwicklertools&#8220; setzen → OK.</p> </div> <div class="schema-faq-section" id="faq-question-1774458709735"><strong class="schema-faq-question"><strong>Was ist der Unterschied zwischen Form-Button und Formular-Schaltfläche?</strong></strong> <p class="schema-faq-answer">Der Form-Button (abgerundetes Rechteck) ist flexibler gestaltbar. Die Formular-Schaltfläche aus dem Entwickler-Tab ist schlichter, aber direkter — das Makro wird beim Erstellen sofort zugewiesen.</p> </div> </div>
<p>Der Beitrag <a href="https://robbelroot.de/blog/excel-makro-button/">Excel Makro Button</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://robbelroot.de/blog/excel-makro-button/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>IFS VBA</title>
		<link>https://robbelroot.de/blog/ifs-vba/</link>
					<comments>https://robbelroot.de/blog/ifs-vba/#comments</comments>
		
		<dc:creator><![CDATA[Robert Skibbe]]></dc:creator>
		<pubDate>Sun, 08 Aug 2021 22:55:15 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Visual Basic for Applications]]></category>
		<category><![CDATA[Visual Basic for Applications lernen]]></category>
		<category><![CDATA[abfrage]]></category>
		<category><![CDATA[abfragen]]></category>
		<category><![CDATA[anweisung]]></category>
		<category><![CDATA[ausdruck]]></category>
		<category><![CDATA[bedingung]]></category>
		<category><![CDATA[bedingungen]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[branching]]></category>
		<category><![CDATA[condition]]></category>
		<category><![CDATA[conditions]]></category>
		<category><![CDATA[different]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[expression]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[ifs]]></category>
		<category><![CDATA[kalkulation]]></category>
		<category><![CDATA[konditionen]]></category>
		<category><![CDATA[makro]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[microsoft 365]]></category>
		<category><![CDATA[msft]]></category>
		<category><![CDATA[office 365]]></category>
		<category><![CDATA[question]]></category>
		<category><![CDATA[result]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[statement]]></category>
		<category><![CDATA[tabellen]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[verzweigung]]></category>
		<category><![CDATA[verzweigungen]]></category>
		<category><![CDATA[visual basic]]></category>
		<guid isPermaLink="false">https://robbelroot.de/?p=5138</guid>

					<description><![CDATA[<p>IFS VBA Möchtest Du mit der IFS VBA Funktion/Formel umzugehen wissen, bzw. verstehen was Diese überhaupt ist? Dann heiße ich Dich in meinem heutigen Beitrag zur Visual Basic for Applications Kategorie herzlich willkommen. Vielleicht steht Dir anschließend auch noch der Sinn nach anderweitigen VBA relevanten Beiträgen: VBA For Schleife, InStr, &#8230;</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/ifs-vba/">IFS VBA</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><a href="https://robbelroot.de/wp-content/uploads/2021/08/IFS-VBA-Funktion-Verzweigung.png"><img loading="lazy" decoding="async" width="1024" height="536" src="https://robbelroot.de/wp-content/uploads/2021/08/IFS-VBA-Funktion-Verzweigung-1024x536.png" alt="" class="wp-image-5140" srcset="https://robbelroot.de/wp-content/uploads/2021/08/IFS-VBA-Funktion-Verzweigung-1024x536.png 1024w, https://robbelroot.de/wp-content/uploads/2021/08/IFS-VBA-Funktion-Verzweigung-300x157.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/IFS-VBA-Funktion-Verzweigung-768x402.png 768w, https://robbelroot.de/wp-content/uploads/2021/08/IFS-VBA-Funktion-Verzweigung-700x366.png 700w, https://robbelroot.de/wp-content/uploads/2021/08/IFS-VBA-Funktion-Verzweigung-332x174.png 332w, https://robbelroot.de/wp-content/uploads/2021/08/IFS-VBA-Funktion-Verzweigung.png 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption>IFS VBA</figcaption></figure>






<h2 class="wp-block-heading">IFS VBA</h2>



<p><strong>Möchtest </strong>Du mit der <strong>IFS VBA</strong> Funktion/Formel umzugehen wissen, bzw. <strong>verstehen was </strong>Diese überhaupt <strong>ist</strong>?</p>



<p>Dann <strong>heiße ich Dich </strong>in meinem heutigen Beitrag zur Visual Basic for Applications Kategorie <strong>herzlich willkommen</strong>.</p>



<p><strong>Vielleicht </strong>steht Dir <strong>anschließend </strong>auch <strong>noch </strong>der Sinn nach anderweitigen <strong>VBA relevanten Beiträgen</strong>: <strong><a href="https://robbelroot.de/blog/vba-for-schleife/" target="_blank" rel="noreferrer noopener">VBA For Schleife</a></strong>, <strong><a href="https://robbelroot.de/blog/vba-instr/" target="_blank" rel="noreferrer noopener">InStr</a></strong>, <strong><a href="https://robbelroot.de/blog/vba-range/" target="_blank" rel="noreferrer noopener">Range</a></strong>.</p>



<pre class="wp-block-verse"><strong>Achtung</strong>! Die IFS Funktion ist <strong>nur im Excel-Kontext</strong> <strong>als Formel </strong>vorhanden! Die dazu <strong>benötigte Excel </strong>Version findet man auf <strong>Windows &amp; Mac</strong>, wenn man <strong>mind. Office 2019</strong>, oder ein <strong>Microsoft 365 Abonnement </strong>hat.</pre>



<h2 class="wp-block-heading">Awendungsfälle</h2>



<p><strong>Wer </strong>kennt es <strong>nicht</strong>? <strong>Man möchte </strong>durch kurze <strong>geschickte Abfragen </strong>den <strong>Ablauf </strong>des Programmes <strong>bestimmen </strong>und <strong>leiten</strong>.</p>



<p><strong>Vielleicht </strong>sind Dir auch schon derartige <strong>Konstroll</strong>&#8211; , bzw. <strong>Verzweigungs-Strukturen</strong> wie das &#8222;If-Then-Else&#8220;- &amp; das &#8222;Select-Case&#8220; <strong>bekannt</strong>.</p>



<p>Das <strong>gut bekannte </strong>&#8222;<strong>If-Then-Else</strong>&#8222;-Konstrukt wird <strong>eher für </strong>die <strong>Abarbeitung</strong>, bzw. Steuerung von <strong>verschiedenen Ausgangspunkten </strong>verwendet.</p>



<p>Ich kann <strong>prüfen</strong>, <strong>ob </strong>die <strong>Performance </strong>einer Aktie <strong>gut </strong>war, <strong>jedoch</strong> dennoch die <strong>Dividende gekürzt </strong>wurde.</p>



<p><strong>Bei </strong>dem &#8222;<strong>Select-Case</strong>&#8222;-Konstrukt hingegen, <strong>prüft </strong>man für <strong>gewöhnlich einen Ausgangspunkt</strong> – z. B. auch <strong>Bereiche </strong>dessen – und handelt je nach Ergebnis.</p>



<p>Bleiben wir bei unserem <strong>kleinen Aktien-Beispiel</strong> und verfahren je nach <strong>Dividendenrendite </strong>anders:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Dim dividendYieldPercentage As Integer = 9
Dim message As String = ""
Select Case
    Case 1 To 2
        message = "Dividend yield is okay!"
    Case 3 To 4
        message = "Woah! Nice yield!"
    Case 5 To 6
        message = "Hmm, nice but maybe too much!?"
    Case Else
        message = "Woah, this is too much to be good!"
End Case</pre>



<h2 class="wp-block-heading">In der Kürze..</h2>



<p><strong>Häufig </strong>sagt man, dass <strong>in </strong>der <strong>Kürze </strong>die bekannte <strong>Würze </strong>liegt, man möchte es also ab und zu gerne <strong>kurz und schmerzlos </strong>haben.</p>



<p><strong>Wenn man </strong>jedoch die <strong>Länge </strong>des jeweiligen <strong>Konstruktes </strong>in <strong>Augenschein </strong>nimmt, hat man ein anderes Gefühl, eher <strong>lang und wiederholend</strong>.</p>



<p><strong>Im Falle </strong>einer <strong>relativ simplen </strong>&#8222;If-<strong>Anweisung</strong>&#8220; <strong>kann </strong>man den <strong>Ausdruck </strong>natürlich auch optional <strong>auf </strong>eine <strong>Zeile reduzieren</strong>.</p>



<p><strong>Je komplexer </strong>die eben erwähnte &#8222;If-Anweisung&#8220; allerdings wird, <strong>desto unlesbarer und unmöglich </strong>wird die Anweisung.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Dim performance As Integer = 100
If performance &lt;= 20 Then MsgBox("Yay")</pre>



<p><strong>Nehmen </strong>wir <strong>allerdings </strong>das Beispiel von oben, wäre es <strong>unlesbar </strong>und teilweise auch <strong>nicht möglich</strong>, daher würde ich nur in <strong>seltenen Fällen </strong>zur <strong>Verkürzung </strong>raten.</p>



<h2 class="wp-block-heading">IFS VBA Erklärung</h2>



<p>Mit der <strong>IFS-Funktion</strong> haben wir eine <strong>weitere Kontrollstruktur</strong>, um den <strong>Ablauf </strong>des &#8222;Programmes&#8220; zu <strong>gestalten</strong>.</p>



<p>Die <strong>IFS VBA (Excel) Formel</strong> wird dabei zunächst <strong>analog </strong>zum <strong>&#8222;Einzeiligen</strong> If&#8220; formuliert, <strong>mit </strong>einem <strong>kleinen Unterschied</strong>.</p>



<p><strong>Statt </strong>weniger <strong>Ausdrücke </strong>wie im If-Beispiel, können wir nun <strong>mehrere Ausdrücke</strong> wie durch Zauberhand <strong>kombinieren</strong>.</p>



<h2 class="wp-block-heading">IFS VBA Syntax – Schreibweise</h2>



<p><strong>Schauen wir</strong> uns zum obigen Vergleich einmal die <strong>Struktur, bzw. die Syntax der IFS-Funktion</strong> an:</p>



<pre class="wp-block-code"><code>=IFS(&lt;condition 1>, &lt;value 1>, &lt;condition 2>, ....)</code></pre>



<p>Dabei stellen wir fest, dass wir <strong>innerhalb </strong>der <strong>Klammern </strong>– also durch Angabe von <strong>Parametern </strong>– verschiedene <strong>Paare an Konditionen </strong>&amp; <strong>Werten </strong>angeben können.</p>



<p>Laut offizieller Dokumentation der <strong><a href="https://support.microsoft.com/en-us/office/ifs-function-36329a26-37b2-467c-972b-4a39bd951d45" target="_blank" rel="noreferrer noopener">IFS VBA Funktion</a></strong> von Microsoft, können wir <strong>bis zu 127 verschiedene Bedingungen</strong> prüfen und auswerten.</p>



<p><strong>Natürlich </strong>sollte man das <strong>nach Möglichkeit vermeiden</strong>, <strong>wer möchte </strong>schon eine gefühlt 40000 Zeichen <strong>lange Zeile</strong> lesen..</p>



<p><strong>Neben </strong>der <strong>schier endlos </strong>langen <strong>Zeile</strong>, hat man natürlich <strong>noch</strong> ein <strong>Problem mit </strong>den einzelnen <strong>Reihenfolgen</strong>, wo man sich dann <strong>leicht irren </strong>kann.</p>



<h2 class="wp-block-heading">Beispiel – Excel Zelle anhand IFS Formel</h2>



<p>Um nun <strong>beispielsweise </strong>den <strong>Wert </strong>einer <strong>Zelle </strong>im <strong>Excel-Sheet</strong> zu setzen, könnte man <strong>analog zu oben</strong> folgendes <strong>Beispiel </strong>verwenden.</p>



<p>Wir <strong>ziehen uns </strong>die <strong>Dividendenrendite </strong>dafür nun <strong>aus </strong>einer <strong>Zelle </strong>namens &#8222;A2&#8220; und setzen den <strong>Wert der Zelle </strong>&#8222;A3&#8220; dann auf <strong>das Ergebnis</strong>.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">=IFS(A2&lt;3, "Yield OK!", A2&lt;5, "Nice yield!", A2&lt;7, "Too much!")</pre>



<p><strong>Wenn </strong>im Beispiel der <strong>Wert </strong>in der Zelle &#8222;A2&#8220; z. B. <strong>unter 3</strong> liegt, dann <strong>gibt </strong>die Formel den Wert <strong>&#8222;Yield OK!&#8220; zurück</strong>.</p>



<p><strong>Bei </strong>einem Wert <strong>unter 5</strong> dann &#8222;<strong>Nice yield!</strong>&#8220; und und und..</p>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/VBA-IFS-Excel.png"><img loading="lazy" decoding="async" width="356" height="155" src="https://robbelroot.de/wp-content/uploads/2021/08/VBA-IFS-Excel.png" alt="VBA IFS Excel" class="wp-image-5159" title="VBA IFS Excel" srcset="https://robbelroot.de/wp-content/uploads/2021/08/VBA-IFS-Excel.png 356w, https://robbelroot.de/wp-content/uploads/2021/08/VBA-IFS-Excel-300x131.png 300w, https://robbelroot.de/wp-content/uploads/2021/08/VBA-IFS-Excel-332x145.png 332w" sizes="auto, (max-width: 356px) 100vw, 356px" /></a><figcaption>VBA IFS Excel</figcaption></figure>



<h2 class="wp-block-heading">Funktioniert übrigens auch bei Google Sheets</h2>



<p>Die <strong>IFS</strong>-Formel gibt es übrigens <strong>auch für</strong> die bekannte <strong>Cloud-Tabellen-Plattform Google Sheets</strong>.</p>



<p>Der <strong>einzige simple Unterschied </strong>ist, dass man dort <strong>statt Kommas</strong> (,) dann <strong>Semikolons</strong> (;) verwenden muss.</p>



<h2 class="wp-block-heading">Aber ich wollte IFS für VBA :(!?</h2>



<p><strong>Kein Problem</strong>! Leider wird man wie oben gesehen bei den Begriffen &#8222;<strong>IFS VBA</strong>&#8220; größtenteils nur im <strong>Bereich </strong>der <strong>Tabellen </strong>– also <strong><a href="https://de.wikipedia.org/wiki/Microsoft_Excel" target="_blank" rel="noreferrer noopener">Microsoft Excel</a></strong> &amp; <strong><a href="https://de.wikipedia.org/wiki/Google_Docs,_Sheets,_Slides_und_Forms#Tabellenkalkulation_(Sheets)" target="_blank" rel="noreferrer noopener">Google Sheets</a></strong> – fündig.</p>



<p><strong>Es gibt </strong>allerdings <strong>auch Codes </strong>wie Dieser hier (vom Stackoverflow-Nutzer &#8222;jsheeran&#8220;), <strong>Welcher </strong>eine <strong>ähnliche Implementierung </strong>im Bereich VBA darstellt:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Public Function UdfIfs(ParamArray args() As Variant) As Variant
  Dim i As Integer
  i = 0 ' or 1 if you're not using zero-based indexing
  Do Until CBool(args(i)) Or (i >= UBound(args))
    i = i + 2
  Loop
  If i &lt; UBound(args) Then
    UdfIfs = args(i + 1)
  End If
End Function</pre>
<p>Der Beitrag <a href="https://robbelroot.de/blog/ifs-vba/">IFS VBA</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://robbelroot.de/blog/ifs-vba/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>VBA For Schleife</title>
		<link>https://robbelroot.de/blog/vba-for-schleife/</link>
					<comments>https://robbelroot.de/blog/vba-for-schleife/#comments</comments>
		
		<dc:creator><![CDATA[Robert Skibbe]]></dc:creator>
		<pubDate>Mon, 19 Jul 2021 19:36:01 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Visual Basic for Applications]]></category>
		<category><![CDATA[Visual Basic for Applications Problemlösungen]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[calculation]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[formel]]></category>
		<category><![CDATA[formeln]]></category>
		<category><![CDATA[formula]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[funktion]]></category>
		<category><![CDATA[funktionen]]></category>
		<category><![CDATA[fußgesteuert]]></category>
		<category><![CDATA[kalkulation]]></category>
		<category><![CDATA[kalkulationen]]></category>
		<category><![CDATA[kopfgesteuert]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[schleife]]></category>
		<category><![CDATA[tabelle]]></category>
		<category><![CDATA[tabellen]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[visual]]></category>
		<category><![CDATA[visual basic]]></category>
		<guid isPermaLink="false">https://robbelroot.de/?p=4519</guid>

					<description><![CDATA[<p>VBA For Schleife Du möchtest die VBA For Schleife zum Durchlaufen von z. B. Zellen verwenden, oder verstehen, was Schleifen sind? Dann starte jetzt durch und lerne in meinem heutigen Beitrag alles Wissenswerte über das für die Programmierung essentielle Thema namens &#8222;Schleifen&#8222;. Vielleicht möchtest Du zu einem späteren Zeitpunkt auch &#8230;</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/vba-for-schleife/">VBA For Schleife</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><a href="https://robbelroot.de/wp-content/uploads/2021/07/VBA-For-Schleife.png"><img loading="lazy" decoding="async" width="1024" height="536" src="https://robbelroot.de/wp-content/uploads/2021/07/VBA-For-Schleife-1024x536.png" alt="VBA For Schleife" class="wp-image-4527" title="VBA For Schleife" srcset="https://robbelroot.de/wp-content/uploads/2021/07/VBA-For-Schleife-1024x536.png 1024w, https://robbelroot.de/wp-content/uploads/2021/07/VBA-For-Schleife-300x157.png 300w, https://robbelroot.de/wp-content/uploads/2021/07/VBA-For-Schleife-768x402.png 768w, https://robbelroot.de/wp-content/uploads/2021/07/VBA-For-Schleife-700x366.png 700w, https://robbelroot.de/wp-content/uploads/2021/07/VBA-For-Schleife-332x174.png 332w, https://robbelroot.de/wp-content/uploads/2021/07/VBA-For-Schleife.png 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption>VBA For Schleife</figcaption></figure>






<h2 class="wp-block-heading" id="vba-for-schleife">VBA For Schleife</h2>



<p>Du <strong>möchtest </strong>die <strong>VBA For Schleife</strong> zum <strong>Durchlaufen </strong>von z. B. <strong>Zellen </strong>verwenden, oder <strong>verstehen</strong>, was <strong>Schleifen </strong>sind?</p>



<p>Dann <strong>starte </strong>jetzt <strong>durch </strong>und <strong>lerne </strong>in meinem <strong>heutigen Beitrag </strong>alles <strong>Wissenswerte </strong>über das für die <strong>Programmierung </strong>essentielle <strong>Thema </strong>namens &#8222;<strong>Schleifen</strong>&#8222;.</p>



<p><strong>Vielleicht </strong>möchtest Du zu einem <strong>späteren Zeitpunkt </strong>auch in meine <strong>folgenden </strong>anderen <strong>Beiträge </strong>reinschauen: <strong><a href="/blog/vba-msgbox" target="_blank" rel="noreferrer noopener">MsgBox</a></strong>, <strong><a href="/blog/vba-range" target="_blank" rel="noreferrer noopener">Range</a></strong>, <strong><a href="/blog/excel-vb-array" target="_blank" rel="noreferrer noopener">VBA Array</a></strong>.</p>



<h2 class="wp-block-heading" id="ein-teil-der-infrastruktur">Ein Teil der Infrastruktur</h2>



<p><strong>Schleifen sind </strong>in der Programmierung ein <strong>essentieller Teil </strong>der <strong>Infrastruktur </strong>und somit <strong>so gut wie in jeder Sprache</strong> ein häufig genutzten <strong>Basis-Werkzeug</strong>.</p>



<p>Nicht umsonst ist das so, denn wir <strong>müssen </strong>an verschiedenen Stellen im Programmablauf gewisse <strong>Dinge wiederholen</strong>.</p>



<p>Die <strong>Konditionen</strong>, bzw. <strong>Bedingungen </strong>für diese Wiederholungen können unterschiedlicher Natur sein und <strong>können sich </strong>während des Programmablaufs <strong>verändern</strong>.</p>



<p><strong>Manchmal </strong>möchten wir <strong>Objekte durchlaufen</strong>, <strong>manchmal </strong>möchten wir Prozeduren und Sub-Prozeduren anhand einer <strong>gewissen Anzahl an Durchläufen </strong>wiederholen.</p>



<h2 class="wp-block-heading" id="nicht-aus-dem-luftverkehr">Nicht aus dem Luftverkehr</h2>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/VBA-For-Schleife-–-Nicht-aus-dem-Luftraum.jpg"><img loading="lazy" decoding="async" width="640" height="360" src="https://robbelroot.de/wp-content/uploads/2021/08/VBA-For-Schleife-–-Nicht-aus-dem-Luftraum.jpg" alt="VBA For Schleife – Nicht aus dem Luftraum" class="wp-image-5828" title="VBA For Schleife – Nicht aus dem Luftraum"/></a><figcaption>VBA For Schleife – Nicht aus dem Luftraum</figcaption></figure>



<p><strong>Anders als </strong>man eventuell als <strong>Nicht-Entwickler</strong> <strong>denken </strong>könnte, haben <strong>Schleifen </strong>in der <strong>Softwareentwicklung </strong>nichts mit &#8222;<strong>eine Schleife fliegen</strong>&#8220; zu tun.</p>



<p><strong>Okay</strong>, zugegebenermaßen wiederholen <strong>Flugzeuge </strong>ja beim <strong>Schleifen</strong>&#8211;<strong>Ziehen </strong>auch vermutlich <strong>gewisse Muster </strong>– insofern ich das beurteilen kann..</p>



<p>Daher läuft es zumindest <strong>ähnlich bei </strong>einer <strong><a href="https://de.wikipedia.org/wiki/Schleife_(Programmierung)" target="_blank" rel="noreferrer noopener">Schleife</a> </strong>in der <strong>Softwareentwicklung</strong> ab, da auch dort <strong>gewisse Prozesse</strong> <strong>wiederholt</strong>, oder zumindest ähnlich abgearbeitet werden.</p>



<h2 class="wp-block-heading" id="denke-z-b-an-ein-kartenspiel">Denke z. B. an ein Kartenspiel</h2>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2022/02/Karten-mischen-und-austeilen2.gif"><img loading="lazy" decoding="async" width="480" height="270" src="https://robbelroot.de/wp-content/uploads/2022/02/Karten-mischen-und-austeilen2.gif" alt="Karten mischen und austeilen" class="wp-image-8405" title="Karten mischen und austeilen"/></a><figcaption>Karten mischen und austeilen – Quelle giphy/asmodeelive</figcaption></figure>



<p><strong>Stell</strong>&#8218; <strong>Dir </strong>mal <strong>ein </strong>gutes altes <strong>Kartenspiel </strong>wie z. B. <strong>Mau-Mau</strong>, oder auch <strong>Skip-Bo</strong> wenn Du möchtest <strong>vor</strong>.</p>



<p>Meistens <strong>werden </strong>in den gängigen Spielen aus einem <strong>vorhandenen Deck</strong> eine gewisse <strong>Anzahl </strong>an <strong>Karten gezogen</strong>.</p>



<p>Diese <strong>müssen </strong>natürlich einerseits <strong>aus </strong>dem <strong>Deck verschwinden und </strong>andererseits <strong>in </strong>Deine <strong>Hand aufgenommen </strong>werden.</p>



<p>So wie ich die Mau-Mau Regeln kenne, <strong>zieht jeder </strong>Spieler zu Beginn des Spiels <strong>7 Karten</strong> aus dem Deck <strong>und sortiert </strong>Diese <strong>wie </strong>Ihm <strong>beliebt</strong>.</p>



<p>Dabei haben wir auch schon ein <strong>wichtiges Kriterium </strong>a la &#8222;7 Karten&#8220; genannt, wir haben also eine Art <strong>Zähler</strong>.</p>



<p>Der <strong>Zähler gibt </strong>dabei <strong>an</strong>, <strong>wie oft </strong>der <strong>Inhalt </strong>der Schleife, also der &#8222;Zieh eine Karte&#8220;-Prozess <strong>wiederholt </strong>werden soll.</p>



<p>Dadurch <strong>wird </strong>der sogenannte <strong>Body </strong>(der Inhalt) der Schleife, anhand einer gewissen <strong>Anzahl von Wiederholungen ausgeführt</strong>.</p>



<h2 class="wp-block-heading" id="schleifen-arten">Schleifen-Arten</h2>



<p><strong>In </strong>der <strong>Programmierung unterscheiden </strong>wir <strong>gängigerweise zwischen zwei </strong>verschiedene <strong>Arten </strong>von Schleifen. Die <strong>Ausführung</strong>, bzw. die <strong>genauere Steuerung </strong>des Schleifeninhalts <strong>kann </strong>unter Umständen <strong>variieren</strong>.</p>



<p><strong>In einigen Fällen </strong>müssen wir eventuell erst ein <strong>bestimmtes Kriterium </strong>überprüfen <strong>und </strong>anschließend den <strong>Inhalt </strong>der Schleife <strong>ausführen</strong>.</p>



<p>In <strong>anderen Fällen </strong>müssen wir hingegen <strong>eventuell </strong>die <strong>Prüfung </strong>für die Ausführung <strong>an </strong>das <strong>Ende </strong>der Schleife <strong>verlagern</strong>.</p>



<p><strong>Siehe </strong>Dir dazu das folgende <strong>Bild </strong>genauer <strong>an</strong>:</p>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Kopfgesteuerte-und-Fussgesteuerte-Schleifen.png"><img loading="lazy" decoding="async" width="1038" height="666" src="https://robbelroot.de/wp-content/uploads/2021/08/Kopfgesteuerte-und-Fussgesteuerte-Schleifen.png" alt="Kopfgesteuerte und Fußgesteuerte Schleifen" class="wp-image-5837" title="Kopfgesteuerte und Fußgesteuerte Schleifen"/></a></figure>



<p><strong>Wie </strong>in dem Teil hier drüber <strong>bereits angeschnitten</strong>, gibt es einerseits die <strong>zählergesteuerte Schleife</strong>. Die <strong>Anzahl der Wiederholungen </strong>einer zählergesteuerten Schleife <strong>wird anhand </strong>eines <strong>Zählers festgelegt</strong>. Der <strong>Zähler kann </strong>dabei natürlich <strong>aus unterschiedlichen Quellen </strong>wie z. B. einer Variable, oder eines Zellenwertes <strong>kommen</strong>.</p>



<h3 class="wp-block-heading" id="kopfgesteuerte-schleifen">Kopfgesteuerte Schleifen</h3>



<p><strong>Bei </strong>den <strong>Kopfgesteuerten Schleifen </strong>handelt es sich um ein Schleifenkonstrukt, Welches die <strong>Bedingung zur Ausführung im Kopf </strong>prüft.</p>



<p><strong>Falls </strong>und auch nur wenn die Bedingung <strong>erfüllt </strong>ist, <strong>wird </strong>der <strong>Body</strong>, also der Inhalt der Schleife <strong>ausgeführt </strong>und <strong>anschließend </strong>wieder <strong>zum Kopf </strong>gesprungen.</p>



<p><strong>Danach </strong>folgt eine <strong>erneute Prüfung </strong>und eine <strong>eventuelle neue Durchführung </strong>– eine Schleife ist geboren!</p>



<h3 class="wp-block-heading" id="fussgesteuerte-schleifen">Fußgesteuerte Schleifen</h3>



<p>Der nächste Schleifen-Typ wäre die <strong>fußgesteuerte Schleife</strong>, Welche analog zur obigen funktioniert.</p>



<p>Hierbei wird <strong>allerdings </strong>die <strong>Überprüfung </strong>der Bedingung erst <strong>im Fuß </strong>durchgeführt.</p>



<p>Das <strong>hat </strong>dann zur <strong>Folge</strong>, <strong>dass </strong>der <strong>Body </strong>der Schleife <strong>zuerst </strong>ausgeführt wird <strong>und </strong>erst <strong>im Fuß</strong> eine <strong>erneute Ausführung</strong> <strong>erörtert </strong>wird.</p>



<h2 class="wp-block-heading" id="der-bezug-zum-code-vba-for-schleife">Der Bezug zum Code – VBA For Schleife</h2>



<figure class="wp-block-image size-full is-resized"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-1.png"><img decoding="async" src="https://robbelroot.de/wp-content/uploads/2021/08/Microsoft-Excel-1.png" alt="Microsoft Excel" class="wp-image-5854" width="480" title="Microsoft Excel"/></a><figcaption>Microsoft Excel</figcaption></figure>



<p><strong>Fangen </strong>wir <strong>nun </strong>einmal <strong>an</strong>, mit dem folgenden Beispiel den konkreten <strong>Bezug</strong> <strong>zum Code </strong>herzustellen. Dabei ist es wichtig zu verstehen, in welchem Kontext die Schleifen arbeiten. Andererseits sollte man diverse gängige Fehler durch die Verwendung von Schleifen vermeiden.</p>



<h3 class="wp-block-heading" id="prozesse-bzw-unterprozesse-aufrufen">Prozesse, bzw. Unterprozesse aufrufen</h3>



<p><strong>Viele anfängliche </strong>Excel-<strong>Programmierer verwenden Code wie </strong>gleich <strong>demonstriert</strong>. Sei es <strong>aus welchen Beweggründen auch immer</strong>: Unwissen, Unsicherheit, etc. <strong>Leider </strong>ist die dann entstehende <strong>Vorgehensweise </strong>wie wir gleich sehen werden, <strong>aus </strong>diversen <strong>Gründen nicht </strong>sehr <strong>vorteilhaft</strong>.</p>



<p><strong>Stellen wir </strong>uns dafür vor, dass wir folgende <strong>3 Unterprozesse</strong> haben, die <strong>zusammen </strong>letztendlich z. B. eine Email  versenden sollen:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">' Deck prüfen
' HandPrüfen
' das Karten ziehen selbst</pre>



<h3 class="wp-block-heading" id="manuell-mehrfach-aufrufen">Manuell mehrfach aufrufen</h3>



<p>Falls man bisher noch keine Berührungspunkte mit Schleifen hatte, könnte man in die bekannteste Versuchung kommen (nicht seit es Schokolade gibt – wer die Werbung noch kennt!).</p>



<p>Dieser <strong>jemand würde </strong>also die obigen <strong>drei Schritte </strong>– hier einfach nur als Kommentare dargestellt – <strong>ggf. so aufrufen</strong>:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">' Deck prüfen
' HandPrüfen
' das Karten ziehen selbst

' Deck prüfen
' HandPrüfen
' das Karten ziehen selbst

' .... pro Spieler wiederholen</pre>



<h3 class="wp-block-heading" id="die-nachteile-bitte-nicht-machen">Die Nachteile – bitte nicht machen!</h3>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/08/Vorsicht.jpg"><img loading="lazy" decoding="async" width="640" height="375" src="https://robbelroot.de/wp-content/uploads/2021/08/Vorsicht.jpg" alt="Vorsicht Zeichen" class="wp-image-5851" title="Vorsicht"/></a><figcaption>Vorsicht</figcaption></figure>



<p>Die dabei <strong>auftretenden Probleme </strong>stechen einem <strong>unerfahrenen </strong>Programmierer häufig <strong>nicht </strong>direkt ins <strong>Auge</strong>.</p>



<h4 class="wp-block-heading" id="folgeanderungen">Folgeänderungen</h4>



<p><strong>Früher </strong>oder später wird man <strong>allerdings </strong>z. B. <strong>auf </strong>das <strong>Problem </strong>stoßen, dass Änderungen an Schritt 2 alle 5 Code-Blöcke betreffen.</p>



<p>Man <strong>müsste </strong>also um <strong>praktisch </strong>eine <strong>Sache </strong>zu <strong>ändern</strong>, 5 Punkte anpassen und <strong>je nachdem</strong> <strong>wie groß </strong>der jeweilige Punkt ist, hat man auch den <strong>Aufwand </strong>– würg!</p>



<p>Dieses Problem <strong>könnte </strong>natürlich <strong>durch </strong>den <strong>Bau</strong> <strong>einer Sub gelöst</strong> werden. Konzentriere dich hierbei bitte nicht zu sehr auf eine Art Implementierung, also die Vorgehensweise selbst. Versuche nach Möglichkeit den abstrakten Weg dahinter zu verstehen. Die konkrete Ausführung des Ziehens selbst ist hier eher irrelevant, viel mehr spielt die Struktur eine Rolle!</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Sub KartenZiehen(anzahlKarten As Integer, spieler As Integer)
  ' Deck prüfen
  ' HandPrüfen
  ' das Karten ziehen selbst
  For i As Integer = 1 To anzahlKarten
    ' realisiere das Ziehen der Karten..
  Next
End Sub</pre>



<p>Der <strong>Aufruf </strong>würde dann durch die Verwendung der Sub <strong>so </strong>aussehen:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">KartenZiehen(7, 1)
KartenZiehen(7, 2)</pre>



<p><strong>Das </strong>ist <strong>natürlich </strong>auch <strong>nicht </strong>wirklich <strong>besser</strong>, wenn wir an das Beispiel <strong>mit </strong>dem <strong>Kartenspiel </strong>denken, denn <strong>allein </strong>die <strong>Formulierung macht </strong>es <strong>aus</strong>:</p>



<pre class="wp-block-verse">"..beim Start des Spiels, zieht <strong>jeder Spieler</strong> X Karten"</pre>



<h4 class="wp-block-heading" id="duplicated-code">Duplicated Code</h4>



<p>Ein <strong>weiteres Problem</strong>, Welches der <strong>obige Code </strong>ganz klar an den Tag legt, ist das <strong>Vorhandensein </strong>von &#8222;<strong>Duplicated Code</strong>&#8222;.</p>



<p>Wir <strong>wiederholen </strong>also <strong>bestehenden Code</strong>, <strong>statt </strong>ihn korrekterweise <strong>in </strong>einer <strong>Schleife aufzurufen</strong>.</p>



<p><strong>Jedes Mal</strong>, <strong>wenn </strong>man z. B. die <strong>Bezeichnung </strong>der Sub <strong>ändern </strong>würde, <strong>müsste </strong>man <strong>im schlimmsten Fall </strong>alle <strong>anderen Vorkommnisse </strong>manuell <strong>ändern</strong>.</p>



<p><strong>Natürlich </strong>gibt es auch <strong>Funktionen </strong>der <strong>Entwicklungsumgebung</strong>, <strong>Welche </strong>uns dabei <strong>helfen könnten</strong>, <strong>allerdings </strong>ist das ja <strong>nicht das Ziel </strong>des Ganzen.</p>



<h2 class="wp-block-heading" id="vba-for-schleife-selbst-zahlergesteuert">VBA For Schleife selbst (zählergesteuert)</h2>



<p>Kommen wir <strong>nun </strong>zur <strong>For</strong>&#8211;<strong>Schleife </strong>bezogen auf das <strong>Beispiel </strong>selbst, womit wir die <strong>obigen Probleme vermeiden</strong>. Auch wenn es hier vermutlich besser wäre eine &#8222;For Each&#8220;-Schleife zu verwenden.. Das Thema hier ist ja schließlich die For- also eine Zählergesteuerte Schleife!</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Dim startHandKartenZahl As Integer
startHandKartenAnzahl = 7
Dim spielerNr As Integer
For spielerNr = 1 To 2
    KartenZiehen(7, spielerNr)
Next</pre>



<p>Diese <strong>Schleifen-Art</strong> <strong>nennt </strong>man auch <strong>zählergesteuerte </strong>und <strong>kopfgesteuerte Schleife</strong>, denn Sie <strong>benutzt </strong>eine <strong>Zähler</strong>&#8211;<strong>Variable </strong>namens &#8222;spielerNr&#8220;.</p>



<p><strong>Ebenso </strong>verwendet die Schleife die <strong>Bedingung </strong>zur Ausführung im Kopf, dass heißt, dass die <strong>Schleife nur ausgeführt </strong>wird, <strong>solange und </strong>nur <strong>wenn </strong>die Bedingung im Kopf &#8222;True&#8220; ergibt.</p>



<h2 class="wp-block-heading" id="vba-for-schleife-zahlergesteuert-ruckwarts">VBA For Schleife (zählergesteuert) rückwärts</h2>



<p><strong>Besonders </strong>cool ist <strong>auch </strong>die <strong>Möglichkeit </strong>die <strong>Schleife </strong>mit wenig Aufwand einfach <strong>rückwärts laufen </strong>zu lassen. In diesem Fall würde also statt der Spieler 1, der Spieler 2 seine Karten zuerst bekommen.</p>



<p>Es kann ja nicht immer nur Mario an Platz 1 sein, sondern auch mal Luigi!</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">For spielerNr = 2 To 1 Step -1
    KartenZiehen(7, spielerNr)
Next</pre>



<h2 class="wp-block-heading" id="ein-weiteres-vba-for-schleife-beispiel-objektgesteuert">Ein weiteres VBA For Schleife Beispiel (objektgesteuert)</h2>



<p>Ein <strong>weiteres </strong>nützliches <strong>Beispiel </strong>für eine VBA For Schleife <strong>wäre </strong>– ich nenne es mal – das <strong>objektgesteuerte Beispiel</strong>.</p>



<p><strong>Statt </strong>wie oben <strong>mit </strong>einer <strong>Zähler</strong>-Variable zu arbeiten, <strong>verwendet </strong>man <strong>hierbei </strong>die tatsächlichen <strong>Objekte </strong>an sich <strong>als Iterationsmöglichkeit</strong>.</p>



<p>Eine <strong>einfache Erklärung </strong>könnte z. B. die gute alte <strong>Chipstüte </strong>bieten, klingt zwar komisch, ist aber so!</p>



<figure class="wp-block-image size-full"><a href="https://robbelroot.de/wp-content/uploads/2021/09/chips.jpg"><img loading="lazy" decoding="async" width="640" height="415" src="https://robbelroot.de/wp-content/uploads/2021/09/chips.jpg" alt="Eine leckere Schale mit Chips aus der Tüte – VBA For Schleife" class="wp-image-5970" title="Eine leckere Schale mit Chips aus der Tüte – VBA For Schleife"/></a><figcaption>Eine leckere Schale mit Chips aus der Tüte – VBA For Schleife</figcaption></figure>



<p>Ich glaube jeder stand schon mal, bzw. steht immer wieder vor dem &#8222;Problem&#8220; <strong>nicht aufhören </strong>zu <strong>können</strong>.</p>



<p><strong>Statt nach </strong>einer kleinen <strong>Portion </strong>bereits <strong>aufzuhören </strong>– was vermutlich auch dem ein oder anderen Fettpölsterchen gut täte – wird <strong>immer weiter </strong>gefuttert.</p>



<p>So könnte man auch bei einer &#8222;<strong>objektgesteuerten</strong>&#8220; For Schleife verfahren, <strong>wörtlich gesprochen </strong>wie folgt:</p>



<ul class="wp-block-list"><li>&#8222;<strong>Für</strong>&#8220; <strong>jeden </strong>einzelnen <strong>Chip</strong></li><li><strong>Nehme </strong>den Chip <strong>in </strong>die <strong>Hand</strong></li><li><strong>Führe </strong>den Chip <strong>in </strong>den <strong>Mund </strong>(öffnen und schließen lasse ich jetzt mal weg..)<br><br>..Du <strong>merkst </strong>vermutlich <strong>worauf </strong>das hier <strong>hinausläuft</strong>.</li></ul>



<p>Der <strong>letztendlich </strong>für das Dein Verständnis <strong>relevante Part </strong>ist hier das &#8222;Für jeden einzelnen Chip..&#8220;.</p>



<h3 class="wp-block-heading" id="alle-chips-in-der-tute-essen-yummy">Alle Chips in der Tüte essen – yummy</h3>



<p>Siehe Dir <strong>folgendes Beispiel </strong>einer VBA Schleife an, um zu verstehen wie ich <strong>obigen Pseudocode </strong>meine.</p>



<p><strong>Beachte </strong>jedoch, dass ich hier die <strong>Deklarationen</strong>, bzw. <strong>Initialisierungen </strong>der Variablen erstmal <strong>weglasse</strong>..</p>



<p>Die &#8222;chips&#8220;-<strong>Auflistung kann </strong>z. B. <strong>auch durch </strong>den Aufruf, also als Rückgabewert einer <strong>Funktion zustande kommen</strong>.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">For Each chip In chips
    Person.Essen(chip)
Next</pre>



<h3 class="wp-block-heading" id="alle-strings-eines-arrays-durchlaufen">Alle Strings eines Arrays durchlaufen</h3>



<p>Ich denke, es ist <strong>noch einfacher</strong>, oder eher näher am Code, <strong>wenn </strong>Du das <strong>folgende Beispiel </strong>siehst:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">' deklariere ein neues Array der Größe 3
Dim namen(0 To 2) As String

' befülle das Array mit Namen
namen(0) = "Robert"
namen(1) = "John"
namen(2) = "Debbie"

For Each name In namen
    ' mach irgendwas mit dem Namen
    ' in der Variable "name"
Next</pre>



<p><strong>Natürlich </strong>funktioniert diese Vorgehensweise <strong>auch </strong>mit <strong>anderen </strong>primitiven <strong>Datentypen </strong>wie z. B. Integern, oder Dates.</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/vba-for-schleife/">VBA For Schleife</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://robbelroot.de/blog/vba-for-schleife/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>VBA InStr</title>
		<link>https://robbelroot.de/blog/vba-instr/</link>
					<comments>https://robbelroot.de/blog/vba-instr/#comments</comments>
		
		<dc:creator><![CDATA[Robert Skibbe]]></dc:creator>
		<pubDate>Sat, 17 Jul 2021 10:27:27 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Visual Basic for Applications]]></category>
		<category><![CDATA[Visual Basic for Applications Problemlösungen]]></category>
		<category><![CDATA[365]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[calculation]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[excel vba]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[kalkulation]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[ms]]></category>
		<category><![CDATA[msft]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[tabelle]]></category>
		<category><![CDATA[tabellen]]></category>
		<category><![CDATA[table]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[visual]]></category>
		<category><![CDATA[visual basic]]></category>
		<category><![CDATA[visual basic for applications]]></category>
		<guid isPermaLink="false">https://robbelroot.de/?p=4431</guid>

					<description><![CDATA[<p>VBA InStr Du möchtest die VBA InStr Funktion lernen und anwenden können und damit überprüfen, ob ein String innerhalb eines Anderen ist? Dann freut es mich, Dir in diesem Beitrag die passende InStr-Funktion vorzustellen! Eventuell hast Du zu einem späteren Zeitpunkt auch Interesse an einem der folgenden Beiträge: Excel VBA &#8230;</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/vba-instr/">VBA InStr</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><a href="https://robbelroot.de/wp-content/uploads/2021/07/VBScript-InStr.png"><img loading="lazy" decoding="async" width="1024" height="536" src="https://robbelroot.de/wp-content/uploads/2021/07/VBScript-InStr-1024x536.png" alt="VBA InStr" class="wp-image-4156" title="VBA InStr" srcset="https://robbelroot.de/wp-content/uploads/2021/07/VBScript-InStr-1024x536.png 1024w, https://robbelroot.de/wp-content/uploads/2021/07/VBScript-InStr-300x157.png 300w, https://robbelroot.de/wp-content/uploads/2021/07/VBScript-InStr-768x402.png 768w, https://robbelroot.de/wp-content/uploads/2021/07/VBScript-InStr-700x366.png 700w, https://robbelroot.de/wp-content/uploads/2021/07/VBScript-InStr-332x174.png 332w, https://robbelroot.de/wp-content/uploads/2021/07/VBScript-InStr.png 1200w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption>VBA InStr</figcaption></figure>






<h2 class="wp-block-heading">VBA InStr</h2>



<p>Du <strong>möchtest </strong>die <strong>VBA InStr</strong> <strong>Funktion lernen </strong>und <strong>anwenden </strong>können und damit <strong>überprüfen</strong>, <strong>ob </strong>ein <strong>String innerhalb </strong>eines <strong>Anderen </strong>ist?</p>



<p>Dann <strong>freut</strong> es <strong>mich,</strong> Dir in diesem Beitrag die passende <strong>InStr-Funktion</strong> <strong>vorzustellen</strong>!</p>



<p><strong>Eventuell</strong> hast Du zu einem späteren Zeitpunkt auch <strong>Interesse an </strong>einem der folgenden <strong>Beiträge</strong>: <strong><a href="/blog/excel-vb-array" target="_blank" rel="noreferrer noopener">Excel VBA Array</a></strong>, <strong><a href="/blog/vba-instr" target="_blank" rel="noreferrer noopener">InStr</a></strong>, <strong><a href="/blog/vba-range" target="_blank" rel="noreferrer noopener">Excel Range</a></strong>.</p>



<h2 class="wp-block-heading">Tabellen-Arbeit – VBA InStr</h2>



<p>Du bist in <strong>Excel VBA</strong> (Visual Basic for Applications) unterwegs und musst in einer <strong>Tabelle </strong>gewisse <strong>Prüfungen durchführen</strong>.</p>



<p>Durch <strong>einzelne Zellen navigierst </strong>Du, nimmst deren <strong>Wert </strong>entgegen und Du müsstest nun <strong>prüfen</strong>, <strong>ob </strong>sich <strong>dort </strong>ein gewisser <strong>Wert im String </strong>befindet?</p>



<p><strong>Je nach </strong>deinem <strong>Ziel </strong>ist es <strong>mehr oder weniger </strong>von <strong>Wichtigkeit</strong>, an <strong>welcher </strong>genauen <strong>Position </strong>sich der <strong>String innerhalb </strong>des anderen <strong>Strings </strong>befindet.</p>



<p><strong>Da </strong>wir <strong>in</strong> <strong>VBA </strong>die aus dem <strong>.NET</strong> bekannte <a style="font-weight: bold;" href="https://docs.microsoft.com/de-de/dotnet/api/system.string.contains?view=net-5.0" target="_blank" rel="noreferrer noopener">Contains-Funktion</a>, leider <strong>nicht verfügbar </strong>ist, müssen wir uns <strong>anders helfen</strong>.</p>



<p><strong>Keine Panik,</strong> <strong>auch </strong>in <strong>VBA </strong>können wir uns wie fast immer mit gängigen Funktionen <strong>helfen</strong>, <strong>jedenfalls </strong>insofern Sie uns <strong>bekannt sind</strong>.</p>



<h2 class="wp-block-heading">Strings durchforsten</h2>



<p>Eine <strong>in VBA befindliche Funktion</strong>, Welche wir für unsere <strong>genannten Ziele </strong>verwenden können, ist die <strong>InStr-Funktion</strong>.</p>



<p>Die <strong>Funktion durchforstet </strong>die <strong>überlieferte Zeichenfolge </strong>und <strong>schaut</strong>, an <strong>Welcher Position </strong>Sie die <strong>Ziel</strong>&#8211;<strong>Zeichenfolge </strong>finden kann.</p>



<p><strong>Falls </strong>Sie die <strong>Zeichenfolge </strong>des Begehrens <strong>nicht finden </strong>kann, gibt Diese als <strong>Rückgabewert </strong>eine <strong>Zahl 0</strong> zurück.</p>



<p>Für den <strong>Vergleich selbst</strong>, haben wir die <strong>Option</strong>, den <strong>Vergleichs</strong>&#8211;<strong>Modus </strong>angeben zu können, wo wir <strong>letztendlich </strong>aus <strong>4 Werten</strong> auswählen können.</p>



<h2 class="wp-block-heading">Die VBA InStr Funktionalität</h2>



<p><strong>Bevor </strong>wir <strong>tiefer ins Geschehen </strong>huschen, <strong>schauen </strong>wir uns wie fast immer vorher einmal die <strong>Aufrufmöglichkeiten </strong>der Funktion <strong>an</strong>.</p>



<h3 class="wp-block-heading">Parameterliste</h3>



<h4 class="wp-block-heading">[Optional] start [Integer]</h4>



<p>Der start-Parameter spezifiziert die <strong>Position</strong>, ab der die Suche <strong>gestartet </strong>wird.</p>



<p>Da der <strong>Parameter </strong>als <strong>optional </strong>gekennzeichnet ist, wird bei <strong>Nicht-Angabe</strong> die <strong>Suche </strong>automatisch <strong>ab Anfang</strong> gestartet.</p>



<h4 class="wp-block-heading">string1 [String]</h4>



<p>Dieser String, ist <strong>sozusagen </strong>das <strong>Subjekt</strong>, also das &#8222;Ding&#8220;, <strong>worin gesucht </strong>wird.</p>



<h4 class="wp-block-heading">string2 [String]</h4>



<p><strong>Hierbei </strong>handelt es sich sozusagen um die <strong>Nadel</strong>, die <strong>im Heuhaufen </strong>– oder Subjekt – <strong>gesucht werden </strong>soll.</p>



<h4 class="wp-block-heading">[Optional] compare [Integer]</h4>



<p>Mit diesem Parameter haben wir die <strong>Möglichkeit </strong>1 der folgenden <strong>Vergleichs-Methoden</strong> zu <strong>konfigurieren</strong>:</p>



<figure class="wp-block-table is-style-stripes"><table><thead><tr><th class="has-text-align-left" data-align="left"><strong>Name</strong></th><th class="has-text-align-left" data-align="left"><strong>Wert</strong></th><th class="has-text-align-left" data-align="left"><strong>Beschreibung</strong></th></tr></thead><tbody><tr><td class="has-text-align-left" data-align="left"><strong>vbUseCompareOption</strong></td><td class="has-text-align-left" data-align="left">-1</td><td class="has-text-align-left" data-align="left">Der Vergleich wird mit der Option Compare-Anweisung ausgeführt.</td></tr><tr><td class="has-text-align-left" data-align="left"><strong>vbBinaryCompare</strong></td><td class="has-text-align-left" data-align="left">0</td><td class="has-text-align-left" data-align="left">Wendet den binären Vergleich an</td></tr><tr><td class="has-text-align-left" data-align="left"><strong>vbTextCompare</strong></td><td class="has-text-align-left" data-align="left">1</td><td class="has-text-align-left" data-align="left">Der Textvergleich wird verwendet</td></tr><tr><td class="has-text-align-left" data-align="left"><strong>vbDatabaseCompare</strong></td><td class="has-text-align-left" data-align="left">2</td><td class="has-text-align-left" data-align="left">Nutzt den Microsoft Access Datenbankvergleich</td></tr></tbody></table><figcaption>VBA InStr Compare Optionen</figcaption></figure>



<p><strong>Wenn </strong>man diesen <strong>Parameter überspringt</strong>, wird die <strong>binäre Vergleichs</strong>-Methode verwendet.</p>



<p>Ich denke die für uns relevanten <strong>Vergleichs-Arten sind</strong>: <strong>vbBinaryCompare</strong> &amp; <strong><strong>vbTextCompare</strong></strong>.</p>



<p>Der <strong>binäre Vergleich</strong>, also die <strong>vbBinaryCompare</strong> Option gibt an, dass die <strong>Zeichen exakt übereinstimmen</strong> müssen.</p>



<p>Die Option <strong>vbTextCompare</strong> hingegen nutzt den <strong>textbasierten Vergleich</strong>, dabei spielen <strong>Groß</strong>&#8211; und <strong>Kleinschreibung keine Rolle</strong>.</p>



<h2 class="wp-block-heading">Code – VBA InStr</h2>



<p>In <strong>diesem Abschnitt </strong>schauen wir uns <strong>Beispiele </strong>an:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="visualbasic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Dim text
text = "Excel is a great tool!"
Dim needle
needle = "great"
Dim result
result = InStr(1, text, needle)
MsgBox(result)</pre>



<p><strong>Zuerst deklarieren </strong>wir eine Variable &#8222;<strong>text</strong>&#8220; und <strong>weisen </strong>ihr danach den Wert &#8222;<strong>Excel is a great tool</strong>!&#8220; <strong>zu</strong>, dies bildet unseren <strong>zu durchsuchenden Text</strong>.</p>



<p>Danach <strong>kommt ein weiterer String</strong> namens &#8222;<strong>needle</strong>&#8220; hinzu, Welche im wahrsten Sinne des Wortes unsere <strong>Nadel im Heuhaufen</strong> darstellt.</p>



<p>Danach <strong>speichern </strong>wir das <strong>Ergebnis </strong>unserer Suche in der &#8222;result&#8220;-Variable <strong>zwischen und geben </strong>Dieses <strong>aus</strong>!</p>



<p><strong>Wenn Du </strong>das Beispiel <strong>ausführst</strong>, <strong>bekommst </strong>Du den <strong>Wert </strong>&#8222;<strong>12</strong>&#8220; angezeigt, <strong>da </strong>sich unser <strong>gesuchtes Wort </strong>&#8222;great&#8220; <strong>an </strong>der <strong>12 Position</strong> im String befindet.</p>
<p>Der Beitrag <a href="https://robbelroot.de/blog/vba-instr/">VBA InStr</a> erschien zuerst auf <a href="https://robbelroot.de">Robert Skibbe</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://robbelroot.de/blog/vba-instr/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
