<?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>iAtoria</title>
	<atom:link href="http://www.iatoria.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.iatoria.com</link>
	<description>Blog of a computer junkie</description>
	<lastBuildDate>Wed, 15 Feb 2012 20:09:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>iLearn Excel VBA: Cells and Ranges</title>
		<link>http://www.iatoria.com/2011/ilearn-excelvba-lesson7</link>
		<comments>http://www.iatoria.com/2011/ilearn-excelvba-lesson7#comments</comments>
		<pubDate>Wed, 14 Dec 2011 20:30:30 +0000</pubDate>
		<dc:creator>Peter Atoria</dc:creator>
				<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.iatoria.com/?p=291</guid>
		<description><![CDATA[Cells and Ranges . . . I&#8217;m lost already! If you open up Excel you will see countless boxes. These boxes are called Cells. You can store many different kinds of variables within these cells including numbers, strings, and even dates. If you highlight a bunch of cells (click on a cell and while holding the left click down, drag your mouse to another cell), you just selected a Range of cells. The row numbers are on the left and the column numbers are denoted as letters across the top row. Now that definitions are out of the way, we [...]]]></description>
			<content:encoded><![CDATA[<h3>Cells and Ranges . . . I&#8217;m lost already!</h3>
<p>If you open up Excel you will see countless boxes.  These boxes are called <strong>Cells</strong>.  You can store many different kinds of variables within these cells including numbers, strings, and even dates.  If you highlight a bunch of cells (click on a cell and while holding the left click down, drag your mouse to another cell), you just selected a <strong>Range</strong> of cells.  The row numbers are on the left and the column numbers are denoted as letters across the top row.  Now that definitions are out of the way, we can move on to cell manipulation.<span id="more-291"></span></p>
<h3>Cell Manipulation</h3>
<p>Let&#8217;s say we want to change the value in Cell A1 which is the top left most cell in the workbook to the value 42.  Let&#8217;s look at the code:</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub CellManipulation()
    Cells(1, 1) = 42
End Sub</pre>
</blockquote>
<p>Yup it&#8217;s that easy.  The syntax is <strong>Cells(row number, column number)</strong> Now let&#8217;s try to make Cell A2 equal to 20 and then add the two cells together.</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub CellManipulation()
    Cells(1, 1) = 42
    Cells(2, 1) = 20
    Cells(3, 1) = Cells(1, 1) + Cells(2, 1)
End Sub</pre>
</blockquote>
<p>Wowee, I think we almost did something noteworthy right there.  Let&#8217;s not limit cell manipulation to just changing values, we can also change the font for a particular cell.  Let&#8217;s make Cell A1 highlighted yellow, Cell A2 Times New Roman font, and Cell A3 size 20:</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub CellManipulation()
    Cells(1, 1) = 42
    Cells(1, 1).Interior.ColorIndex = 6 'Yellow
    Cells(2, 1) = 20
    Cells(2, 1).Font.Name = &quot;Times New Roman&quot;
    Cells(3, 1) = Cells(1, 1) + Cells(2, 1)
    Cells(3, 1).Font.Size = 20
End Sub</pre>
</blockquote>
<p>But now everything is all messy and gross, let&#8217;s bring it back to normal by clearing everything:</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub ClearEverything()
    Cells.Clear
End Sub</pre>
</blockquote>
<p>Now as you can see, we can do a lot with cell manipulation.  Let&#8217;s see what we can do with ranges.</p>
<h3>Range Manipulation</h3>
<p>Now let&#8217;s assume that we have cells A1 through A10 filled with pseudo-random numbers between 1 and 100 and we want to see who passed, who failed, what the class average was, and what the highest score was.  So we will change the font color to red for those who failed and green for those who passed.  <strong>Try it on your own</strong> then have a look at the code:</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub RangeExample()
    'For loop puts a random number (1-100) in the first 10 cells
    For i = 1 To 10
        Cells(i, 1) = Int((100 - 1 + 1) * Rnd + 1)
    Next i
    Cells(1, 2) = &quot;Average&quot;
    Cells(1, 3) = Application.Average(Range(Cells(1, 1), Cells(10, 1)))
    Cells(2, 2) = &quot;Maximum&quot;
    Cells(2, 3) = Application.Max(Range(Cells(1, 1), Cells(10, 1)))
    For j = 1 To 10
        If (Cells(j, 1) &gt;= 60) Then
            Cells(j, 1).Font.ColorIndex = 4 'Green
        Else
            Cells(j, 1).Font.ColorIndex = 3 'Red
        End If
    Next j
End Sub</pre>
</blockquote>
<p>Lines 2-5 is just a fancy way to generate random numbers and you can ignore it for now.  Line 7 finds the average of a range.  The syntax for a range selection is <strong>Range(Cells(row number, column number), Cells(row number, column number)</strong> where the first cell is the top left most cell in your range and the second cell is the bottom right most cell in your range.  This does not need to be just a row or column range, you can select multiple rows and columns.  This is great for making charts.</p>
<p>With just this basic knowledge of cell manipulation and range manipulation, we can do almost anything involving calculations or custom formula solvers.  It doesn&#8217;t look like people are that interested in Excel VBA, so if the people want more examples/tutorials I will make them, but for now I might be moving to something more interesting like Actionscript 3.0. ~Signing Off <strong>iAtoria</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iatoria.com/2011/ilearn-excelvba-lesson7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iLearn Excel VBA: Select-Case</title>
		<link>http://www.iatoria.com/2011/ilearn-excelvba-lesson6</link>
		<comments>http://www.iatoria.com/2011/ilearn-excelvba-lesson6#comments</comments>
		<pubDate>Wed, 14 Dec 2011 20:30:10 +0000</pubDate>
		<dc:creator>Peter Atoria</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.iatoria.com/?p=282</guid>
		<description><![CDATA[The Forgotten Select-Case The Select-Case is often ignored when programming as it can be easily substituted with If-Then-Else statements. It functions much like a If-Then-Else statement and computes a conditional where if true, completes a segment of code. Let&#8217;s look at the example: The output you will see in your Immediate Window will be Grade: C. In lines 2-3 we declare i to be an integer with a value of 79. Line 4 enters the Select-Case statement. It then proceeds to ask in line 5 &#8220;in the case that i is in between 0 and 59 inclusive (0]]></description>
			<content:encoded><![CDATA[<h3>The Forgotten Select-Case</h3>
<p>The <strong>Select-Case</strong> is often ignored when programming as it can be easily substituted with If-Then-Else statements.  It functions much like a <strong>If-Then-Else</strong> statement and computes a conditional where if true, completes a segment of code.  Let&#8217;s look at the example:<span id="more-282"></span></p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub SelectCaseStatment()
    Dim i As Integer
    i = 79
    Select Case i
        Case 0 To 59
            Debug.Print &quot;Grade: F&quot;
        Case 60 To 69
            Debug.Print &quot;Grade: D&quot;
        Case 70 To 79
            Debug.Print &quot;Grade: C&quot;
        Case 80 To 89
            Debug.Print &quot;Grade: B&quot;
        Case 90 To 100
            Debug.Print &quot;Grade: A&quot;
        Case Else
            Debug.Print &quot;You need to enter a value between 0 and 100&quot;
    End Select
End Sub</pre>
</blockquote>
<p>The output you will see in your Immediate Window will be <strong>Grade: C</strong>.  In lines 2-3 we declare i to be an integer with a value of 79.  Line 4 enters the Select-Case statement.   It then proceeds to ask in line 5 &#8220;in the case that i is in between 0 and 59 inclusive (0 <= i <= 59), complete the statement below."  We can clearly see that the case that our integer will follow is the case in line 9.  The <strong>Select-Case</strong> is pretty simple to understand and I won&#8217;t delve too deeply into it, but it may be useful to you in the future.  We are now finished with all the basics of Excel VBA, next time we will finally begin manipulating Cells &#038; Ranges, signing off ~<strong>iAtoria</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iatoria.com/2011/ilearn-excelvba-lesson6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iLearn Excel VBA: Do-While-Loop</title>
		<link>http://www.iatoria.com/2011/ilearn-excelvba-lesson5</link>
		<comments>http://www.iatoria.com/2011/ilearn-excelvba-lesson5#comments</comments>
		<pubDate>Wed, 07 Sep 2011 19:19:43 +0000</pubDate>
		<dc:creator>Peter Atoria</dc:creator>
				<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.iatoria.com/?p=271</guid>
		<description><![CDATA[A Different Kind of Loop A Do-While-Loop is similar to a For-Loop in the sense that they are both iteration statements. The only difference is that the Do-While-Loop has a conditional statement that it uses to determine whether or not the loop shall continue. Take a look: After executing the code above you should get the integers 1-10 displayed in your immediate window. Line 4 reads exactly as it shows, keep looping while x is less than or equal to 10. We print x in line 5 and increase it&#8217;s value by 1 in line 6. Then the loop statement [...]]]></description>
			<content:encoded><![CDATA[<h3>A Different Kind of Loop</h3>
<p><strong>A Do-While-Loop</strong> is similar to a <strong>For-Loop</strong> in the sense that they are both iteration statements.  The only difference is that the Do-While-Loop has a conditional statement that it uses to determine whether or not the loop shall continue.  Take a look:<span id="more-271"></span></p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub TheDoWhileLoop()
    Dim x As Integer
    x = 1
    Do While (x &lt;= 10)
        Debug.Print x
        x = x + 1
    Loop
End Sub</pre>
</blockquote>
<p>After executing the code above you should get the integers 1-10 displayed in your immediate window.  Line 4 reads exactly as it shows, keep looping while x is less than or equal to 10.  We print x in line 5 and increase it&#8217;s value by 1 in line 6.  Then the loop statement in line 7 sends it back to line 4.  This is exactly what the <strong>For-Loop</strong> did, but instead you have to manually change the variable that is in the conditional statement, which can lead to . . . </p>
<h3>The Loop . . . It&#8217;s Never Ending!!!</h3>
<p><strong>READ THIS WHOLE SECTION BEFORE TRYING THIS!!</strong>  Try deleting line 6 and re-running the code.  Finished yet?   How about now?  Notice that because we never increase the x value manually the conditional statement will always be true because x will remain 1.  This is called a never ending loop.  I have run into many a never ending loops in my day and unless you are a programming prodigy, you will too.  There are a couple ways to get out of this never ending loop, here are a few:</p>
<blockquote><h4>Steps to take to kill your code execution:</h4>
<ol>
<li>Hit the Escape Key a couple times</li>
<li>Hit the Pause/Break Key a couple times</li>
<li>Press Ctrl+C a couple times</li>
<li>If none of the above key combos worked then Ctrl+Alt+Delete and kill Excel</li>
</ol>
<p></p></blockquote>
<p>Join me next time as I talk about the under appreciated <strong>Select-Case</strong>, signing off ~<strong>iAtoria</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iatoria.com/2011/ilearn-excelvba-lesson5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iLearn Excel VBA: For-Loop</title>
		<link>http://www.iatoria.com/2011/ilearn-excelvba-lesson4</link>
		<comments>http://www.iatoria.com/2011/ilearn-excelvba-lesson4#comments</comments>
		<pubDate>Sun, 28 Aug 2011 00:04:31 +0000</pubDate>
		<dc:creator>Peter Atoria</dc:creator>
				<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.iatoria.com/?p=262</guid>
		<description><![CDATA[For-Loops Spin You Right Round The For-Loop is an iteration statement. An iteration statement is one that repeats a segment of code until a desired result is achieved. Each repetition is called an iteration. Again, it&#8217;s easier to learn by example: After running the procedure above you will see 1 through 10 printed in your immediate window. In line 2 we declare the For-Loop and create a variable i which is equal to 1. In the same line we ask for i to increase by 1 until it equals 10 which will end the loop. Line 4 tells us to [...]]]></description>
			<content:encoded><![CDATA[<h3>For-Loops Spin You Right Round</h3>
<p>The <strong>For-Loop</strong> is an iteration statement.  An iteration statement is one that repeats a segment of code until a desired result is achieved.  Each repetition is called an iteration.  Again, it&#8217;s easier to learn by example:<span id="more-262"></span></p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub TheForLoop()
    For i = 1 To 10
        Debug.Print i
    Next i
End Sub</pre>
</blockquote>
<p>After running the procedure above you will see 1 through 10 printed in your immediate window.  In line 2 we declare the <strong>For-Loop</strong> and create a variable i which is equal to 1.  In the same line we ask for i to increase by 1 until it equals 10 which will end the loop.  Line 4 tells us to increase i by 1 and the code goes back to line 2.  Here we can see the looping effect first hand.</p>
<h3>Wait a For-Loop within a For-Loop?</h3>
<p>This lesson is fairly short so let&#8217;s delve into a more advanced looping technique which you will likely use in the future . . . The <strong>Double For-Loop</strong>.  It&#8217;s exactly what it sounds like, its a <strong>For-Loop</strong> with a <strong>For-Loop</strong> inside of it.  Let&#8217;s say we wanted to write values in a 8&#215;4 grid in your excel sheet a <strong>Double For-Loop</strong> could be used to access these cells and write the values.  Take a look at this code, execute it and see if you can tell what is happening:</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub TheForLoop()
    For i = 1 To 8
        For j = 1 To 4
            Cells(i, j) = 100
        Next j
    Next i
End Sub</pre>
</blockquote>
<p>Line 4 is new.  This is how you write values into cells.  This will be discussed later, but essentially, Cells(1,1) is row 1 column A,  Cells(1, 2) is row 1 column B and so on.  The best way to understand code is to follow it line by line.  See if you can tell the order in which the lines are executed (ANSWER: 1, 2, 3-4-5, 3-4-5, 3-4-5, 3-4-5, 6, 2, 3-4-5, 3-4-5, 3-4-5, 3-4-5, 6, see the pattern?).  Note that a <strong>For-Loop</strong> doesn&#8217;t always need to start at 1, it can start at any number.  Next time we&#8217;ll talk about the Do-While-Loop, signing off ~<strong>iAtoria</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iatoria.com/2011/ilearn-excelvba-lesson4/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iLearn Excel VBA: If-Then-Else</title>
		<link>http://www.iatoria.com/2011/ilearn-excelvba-lesson3</link>
		<comments>http://www.iatoria.com/2011/ilearn-excelvba-lesson3#comments</comments>
		<pubDate>Sat, 27 Aug 2011 23:24:18 +0000</pubDate>
		<dc:creator>Peter Atoria</dc:creator>
				<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.iatoria.com/?p=209</guid>
		<description><![CDATA[The Almighty If-Then-Else The If-Then-Else is a perfect example of a conditional statement. A conditional statement is a true/false statement that is computed to determine if a code segment should be executed. Let&#8217;s have a look at a practical example: If you copy and paste the above sub routine into a module you will see i equals 100 displayed in your immediate window. We can see in lines 2 and 3 that i is an integer that equals 100. Line 4 asks if variable i equals 100 then execute the following code. Now that we understand how conditionals work, let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<h3>The Almighty If-Then-Else</h3>
<p>The <strong>If-Then-Else</strong> is a perfect example of a conditional statement.  A conditional statement is a true/false statement that is computed to determine if a code segment should be executed.  Let&#8217;s have a look at a practical example:<span id="more-209"></span></p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub TheIfStatement()
    Dim i As Integer
    i = 100
    If (i = 100) Then
        Debug.Print &quot;i equals 100&quot;
    End If
End Sub</pre>
</blockquote>
<p>If you copy and paste the above sub routine into a module you will see <strong>i equals 100 displayed</strong> in your immediate window.  We can see in lines 2 and 3 that i is an integer that equals 100.  Line 4 asks if variable i equals 100 then execute the following code.  Now that we understand how conditionals work, let&#8217;s expand the <strong>If-Then-Else</strong> statement to it&#8217;s full potential:</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub TheIfStatement()
    Dim i As Integer
    i = 100
    If (i = 100) Then
        Debug.Print &quot;i equals 100&quot;
    ElseIf (i = 0) Then
        Debug.Print &quot;i equals 0&quot;
    Else
        Debug.Print &quot;i equals something else&quot;
    End If
End Sub</pre>
</blockquote>
<p>It is basically the same module with a little addition.  Line 4 remains the same, but now line 6 asks, alright if i does not equal 100 and i equals 0 then execute the following code.  Also, newly added is line 8 where it asks, alright if i does not equal 100 or 0 then execute the following code.  This is the easiest and most used statement in most Visual Basic scripts.  Note here that I only have 1 ElseIf in my <strong>If-Then-Else</strong>, but you can as many as you want.  Next time let&#8217;s chat about a For-Loop and what it does, signing off ~<strong>iAtoria</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iatoria.com/2011/ilearn-excelvba-lesson3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iLearn Excel VBA: Procedures and Data Types</title>
		<link>http://www.iatoria.com/2011/ilearn-excelvba-lesson2</link>
		<comments>http://www.iatoria.com/2011/ilearn-excelvba-lesson2#comments</comments>
		<pubDate>Tue, 14 Jun 2011 14:55:02 +0000</pubDate>
		<dc:creator>Peter Atoria</dc:creator>
				<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.iatoria.com/?p=183</guid>
		<description><![CDATA[Variables and Data Types Variables are like boxes. You can change the contents of the box whenever you want and you can change the label of the box depending on what you want to put inside. Variables must not start with a number, must not have spaces, and must not contain symbols. For example, &#8220;Happy&#8221; is acceptable, &#8220;1Happy&#8221;, &#8220;Ha ppy&#8221;, and &#8220;Happy!&#8221; are all unacceptable variable names. Let&#8217;s make it easy and start with variable foo. Variable foo is undeclared at the moment, meaning he doesn&#8217;t know whether he is a string, integer, or other data type. First let&#8217;s see [...]]]></description>
			<content:encoded><![CDATA[<h3>Variables and Data Types</h3>
<p>Variables are like boxes.  You can change the contents of the box whenever you want and you can change the label of the box depending on what you want to put inside.  Variables must not start with a number, must not have spaces, and must not contain symbols.  For example, &#8220;Happy&#8221; is acceptable, &#8220;1Happy&#8221;, &#8220;Ha ppy&#8221;, and &#8220;Happy!&#8221; are all unacceptable variable names.  Let&#8217;s make it easy and start with variable <strong>foo</strong>.  Variable <strong>foo</strong> is undeclared at the moment, meaning he doesn&#8217;t know whether he is a string, integer, or other data type.  First let&#8217;s see what <strong>foo</strong> can choose to be:<span id="more-183"></span></p>
<blockquote><h4>Common Data Types</h4>
<ul>
<li><strong>Byte</strong> = any number between 0 and 255</li>
<li><strong>Integer</strong> = any number between -32,768 and 32,767</li>
<li><strong>Long</strong> = any number between -2,147,483,648 and 2,147,483,648</li>
<li><strong>Single</strong> = any decimal between -3.402823E+38 and 3.402823E+38</li>
<li><strong>Double</strong> = any decimal between -1.79769313486232e+308 and 1.79769313486232e+308</li>
<li><strong>String</strong> = 0 to 2,000,000,000 characters</li>
<li><strong>Boolean</strong> = True or False</li>
<li><strong>Object</strong> = any embedded object</li>
<li><strong>Variant</strong> = any number as large as a Double or any String, but not both</li>
</ul>
</blockquote>
<p>Note that these are not all of the data types, just the ones commonly used.  Now that we know what <strong>foo</strong> can be let&#8217;s assume <strong>foo</strong> wants to be an Integer.  Let&#8217;s declare him as one:</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub MyFirstModule()
    Dim foo As Integer
End Sub</pre>
</blockquote>
<p>Now <strong>foo</strong> is a happy Integer, but he has nothing inside of him.  Let&#8217;s make <strong>foo</strong> equal to 42.</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub MyFirstModule()
    Dim foo As Integer
    foo = 42
End Sub</pre>
</blockquote>
<p>Now <strong>foo</strong> is a happy Integer whose value is 42.</p>
<h3>Subs and Functions</h3>
<p>So there are only 2 different types of ways you can define a procedure.  They are Sub and Function.  Sub is generally used when you do not need to return a result and Function is used when you want a result returned.  For example, if you want your procedure to add two numbers together then return the result you would use a Function.  Remember <strong>foo</strong> the happy Integer whose value is 42?  Well let&#8217;s write a Function that doubles the size of an integer and returns it.  Then let&#8217;s have a Sub call that Function and print out the value.</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub MyFirstModule()
    Dim foo As Integer
    foo = 42
    foo = DoubleIntegers(foo)
    Debug.Print foo
End Sub

Function DoubleIntegers(d As Integer) As Integer
    DoubleIntegers = d * 2
End Function</pre>
</blockquote>
<p>Whoah, whoah, whoah, let&#8217;s slow down a bit.  A lot of things just happened in the last minute.  First we see that you can have multiple Sub and Function procedures in the same module without a problem.  </p>
<p>Second, we see that Function procedures can take an argument and set a return data type.  In line 8 of the code we are essentially saying that &#8220;hey function, you are going to be returned as an Integer, and you will receive an Integer temporarily named &#8220;d&#8221; to work with.&#8221;  Note that Sub procedures can also take arguments, but they cannot return a result.  </p>
<p>Third, we can see that Sub and Function procedures can call one another to complete tasks.  </p>
<p>Whew, you now can make basic level procedures.  If you run the <strong>MyFirstModule</strong> procedure you will get a value of 82 returned in the immediate window.  Next time we will discuss conditionals and loops.  Signing Off ~<strong>iAtoria</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iatoria.com/2011/ilearn-excelvba-lesson2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iLearn Excel VBA &#8211; Introduction</title>
		<link>http://www.iatoria.com/2011/ilearn-excelvba-lesson1</link>
		<comments>http://www.iatoria.com/2011/ilearn-excelvba-lesson1#comments</comments>
		<pubDate>Fri, 10 Jun 2011 14:00:09 +0000</pubDate>
		<dc:creator>Peter Atoria</dc:creator>
				<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.iatoria.com/?p=171</guid>
		<description><![CDATA[Why Do You Need It? If you are reading this then you already found a reason why you want to learn Excel VBA. I will be using Microsoft Excel 2007 to demonstrate all the amazing things you can do. All versions of Microsoft Office have a Visual Basic Editor built right in, so you don&#8217;t need to buy anything extra. Note that, although you are learning Visual Basic through Excel, you could apply it to other applications that use Visual Basic as well. Setting Up Your Workspace Open up Excel 2007 and you will have an empty worksheet labeled Book1 [...]]]></description>
			<content:encoded><![CDATA[<h3>Why Do You Need It?</h3>
<p>If you are reading this then you already found a reason why you want to learn Excel VBA.  I will be using Microsoft Excel 2007 to demonstrate all the amazing things you can do.  All versions of Microsoft Office have a Visual Basic Editor built right in, so you don&#8217;t need to buy anything extra.  Note that, although you are learning Visual Basic through Excel, you could apply it to other applications that use Visual Basic as well.</p>
<h3>Setting Up Your Workspace</h3>
<p>Open up Excel 2007 and you will have an empty worksheet labeled Book1 or something along those lines.  The first thing we want to do is get a developer tab.<span id="more-171"></span></p>
<blockquote><h4>Getting the Developer Tab</h4>
<ol>
<li>Click on the big circle Microsoft button in the upper left hand corner</li>
<li>Click on &#8220;Excel Options&#8221; it should be right next to &#8220;Exit Excel&#8221;</li>
<li>Click on &#8220;Popular&#8221; tab on left if not already on it</li>
<li>Check the box labeled &#8220;Show Developer tab in the Ribbon&#8221;</li>
</ol>
<p></p></blockquote>
<p>Now that we have a Developer Tab, click on it and then click on the first icon labeled <strong>Visual Basic</strong>.  You should see another window open, get used to this window, it is your Visual Basic Editor and it is where you will be doing a majority of your coding.  Notice on the left you have a project explorer with a breakdown of all the sheets in your workbook, as well as your modules.  Wait, you don&#8217;t know what a module is?  Of course you don&#8217;t you just started how silly of me.</p>
<h3>Making Your First Module</h3>
<p>If you followed above you should have your empty Visual Basic Editor open.  Now click on Insert->Module.  You should have a white empty screen open up.  Now enter this code into the module:</p>
<blockquote><pre class="brush: vb; title: ; notranslate">Sub MyFirstModule()
    Debug.Print &quot;My First Module!&quot;
End Sub</pre>
</blockquote>
<p>There are many ways to run this Sub procedure, here are a couple different ones:</p>
<ul>
<li>Click the green play arrow in the Visual Basic Editor at the top of the screen</li>
<li>Press &#8220;F5&#8243;</li>
<li>Click on Run->Run Sub/UserForm</li>
<li>In Excel, click on Macros under the Developer tab, then select the Sub and click &#8220;Run&#8221;</li>
</ul>
<p>You should see <strong>My First Module!</strong> in your <strong>Immediate Window</strong> below.  If you do not have an <strong>Immediate Window</strong> simply go to View->Immediate Window and it will pop up at the bottom of the Visual Basic Editor.  If you see the text you did everything right, now we just need to understand what the heck we just did . . . next time.  Signing Off ~ <strong>iAtoria</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iatoria.com/2011/ilearn-excelvba-lesson1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

