Date: Wed, 15 Sep 2010 14:45:47 -0500 (CDT) From: Mark Jacobson To: 810-022-01-fall@uni.edu Subject: Tuesday group exercise, Excel VBA Functions... Right() function... Hi 022 students, http://www.cs.uni.edu/~jacobson/22/f10/ExcelVBAfunctions.pdf 1. Functions in Visual Basic for Applications (VBA) always produce and return a result. You always have to specify the type of RESULT the VBA Function will return. Type is usually Integer or Double or String or Single. Single and Double are just numbers with decimal points, such as 12.75 and 3.14159 and -33.5 and 0.17 and so on. Integer means a whole number such as 1 or 2 or 16 or 14 or 0 or -8 or 105222 or 2010 and so on. String means "Ghostbusters" or "Dr. Egon Spengler" or "C3PO" or "UNI Panthers" and so on. 2. Subs do something, but do NOT return a result. SUBs are also known as Procedures or SUBroutines. 3. Please STUDY the following followup to the Tuesday group exercise and lecture notes you took prior to the group exercise and the notes you took during the group exercise while working out the problem and talking about it with the other members of your group and writing down ideas and insights and confusions with your pen or pencil. Biction: If the ink don't flow, the understanding don't grow. The last 3 letters of the word THINK = INK, or --- 12345 INK =RIGHT("THINK", 3) using the Excel function RIGHT(), which has TWO ARGUMENTS, or you might also hear 2 parameters you need to give it, would return the STRING type result: INK, which its useful to show you as "INK" to emphacize its a STRING of 3 characters, or a STRING of LENgth 3. =LEN("INK") would return the INTEGER type result 3. I should have said the RIGHTmost 3 characters of the word THINK would be INK. 12345 --- =RIGHT( 1st argument, 2nd argument ) =RIGHT( the STRING data, How many (Integer) characters you need ) ------ ------- =RIGHT( 1st argument, 2nd argument ) Input the function needs: 1st arg: myStr or Some String like "PANTHERS" 2nd arg: n or Some Integer like 4 Output the function gives or produces: A String of the n rightmost characters found in the String myStr. Now you understand WHAT the RIGHT() function does. ---- i. You know WHAT to give it, the INPUT it needs. ii. You know WHAT its result or output will be, for a given example or in general. Basically, you have a good understanding of WHAT it does! It is NOT a user defined function that you wrote or I wrote, so we cannot look inside it and see HOW it does its work. --- If there were no RIGHT() function, then I could now have you figure out the HOW and try to WRITE the RIGHT function, so it transformed the GIVEN input into the GOAL output. Separating WHAT from HOW is the key to problem solving, programming in Excel VBA or Flash ActionScript or Adobe After Effects Expressions languages. Amazingly, if you want to get good at Flash or After Effects or Photoshop or other packages, these principles and methods and approach even can make you much more productive and effective and able to tackle more complex productions, so DO NOT THINK it applies only to VBA or Actionscript or Expressions. It applies to using complex software packages and being able to more effectively do amazing things with them in less time. And companies like that. They like it a lot! So please review your lecture and your small group discussion notes from Tuesday's class, and take some more notes on your notes, and take some notes on the following: http://www.cs.uni.edu/~jacobson/22/f10/ExcelVBAfunctions.pdf Write those notes with flowing ink, or get the lead out of a pencil and onto your notebook or some scratch paper. Either way. Let the ink flow and feel the understanding start to grow. Of dull your sharp pencil to sharpen up your capable mind and head to the pencil sharpener as needed, feeling sharper brain than before and sharpening new skills and abilities as you do the sharpening of your hand-held instrument. Showing up for class doesn't mean just sitting there. Showing up means take it home, take it on home with you and get the most out of your education. You will dig it more if you try to do your best a little more often and no student does their best in most every UNI class unless they take at least a page or two of notes (minimum) for every class or for every reading at the library session for that matter. We are in the computer lab StudioIT 1 - ITT 134 on Thursday, tomorrow. StudioIT 1 (ITT 134) is the largest 2nd floor computer lab/classroom so there will be enough seats even if we have perfect attendance. http://www.cs.uni.edu/~jacobson/22/f10/ExcelVBAfunctions.pdf Your sunny.uni.edu accounts will be ready and I will show you how to use it if you have never had one before. They were generated for everyone who is registered for the class, unless you already had one from taking some previous UNI class that used them. Mark Subject: Tuesday group exercise, Excel VBA Functions... Right() function... I suppose it could be: Subject: Get it right and write! Right? I miss Wright, as most my classes were in Wright 105 between 1994 and 2004 or so. So writing notes in Wright about Right(), perhaps with your right hand, unless you are left-handed, to make sure to get the concepts right no longer works as well as a phrase. http://www.cs.uni.edu/~jacobson/22/f10/ExcelVBAfunctions.pdf