VBA Programming 101: Lecture 01

FarRockBF··5 votes·1,063 views

Before I begin Excel or VBA there are three terms you need to be very comfortable with: Strings, variables, and functions. So without further ado,

STRING: A string is more than one character in a row. Example of strings: 18463 ADJOGKN FEH355#%^

Q) How does a computer program know that what you are entering is a STRING and not some other data type (such as a function or variable)? A) Almost all programming languages require quotes around a string. This tells the program not to do any fancy shtick on it, just read it as just a jumble of characters.

So, if a program sees: **Hello **- it is going to try to figure out how to execute the program Hello. But if you put quotes around it: "Hello" the program will now know that this is just a dumb string you want it to accept. It will not attempt to do any fancy magic with it.

Variable: A variable is a character (usually a letter) that can change its meaning. The word variable comes from two words: VARY + ABLE, so it is able to change.

An example:

Let's say X is equal to 7. This statement is true: "There are X days in a week".

Now if we change X and say X = 9, the statement "There are X days in a week" is FALSE. Same statement, but what you reassign the variable to a different meaning, it means something entirely different.

**Function: **A machine that accepts an input, does some predetermined procedure to the input value, and returns the new value.

An example:

Let's call our function Bob. Function Bob takes anything that is put into it and DOUBLES IT. So what would happen if we put $3 into Bob? Let's find out!

Bob($3) = $6

"( )" is where you place the input usually, and after the "=" is where your output value will come. Let's look at another:

Bob("Cat") = "Cat Cat"

So here we put in a string and Bob doubled our input as expected.

Thanks for tuning in guys, and please vote this thread up if you enjoyed this read. It takes quite a bit of time to put together but if I see people are enjoying them I will continue posting these lectures.

FarRock

9 Comments

Battleforge4Life2 votes

Ty for this

FarRockBF1 votes

{quoted}

Ty for this

YW.

Such a response on the original thread and this is a ghost. Problem is how quickly these things get bumped down...maybe it's not worth the effort.

Gavran3 votes

Red tracker brings in lots of eyes, that's how I saw it. Also, did you link here in the last one at all? I ended up bookmarking your... feed thing to not miss it, but not everyone plans that far ahead. I'd definitely add links to previous, next, and a table of contents type post. Something like this is (mostly) going to turn off the random person to stumble on it, and Boards are optimized to show a "random" (really the group of people who is on at that given time) selection of people new content. Without those votes, not a lot of other people will see it at all. So you need a way to get those people who did show interest to each new post - links like I mentioned, and hope that they'll use them.

On the other hand, I once spoke with a gentleman who put out a video class for beginning Java programmers and there was a pretty interesting phenomenon where a lot of people started the series but staggeringly few finished it. It's just one sample, but that and some of my own classroom experience has convinced me there are more people who think they want to learn programming than people who actually want to learn programming.

FarRockBF1 votes

{quoted}

Red tracker brings in lots of eyes, that's how I saw it. Also, did you link here in the last one at all? I ended up bookmarking your... feed thing to not miss it, but not everyone plans that far ahead. I'd definitely add links to previous, next, and a table of contents type post. Something like this is (mostly) going to turn off the random person to stumble on it, and Boards are optimized to show a "random" (really the group of people who is on at that given time) selection of people new content. Without those votes, not a lot of other people will see it at all. So you need a way to get those people who did show interest to each new post - links like I mentioned, and hope that they'll use them.

On the other hand, I once spoke with a gentleman who put out a video class for beginning Java programmers and there was a pretty interesting phenomenon where a lot of people started the series but staggeringly few finished it. It's just one sample, but that and some of my own classroom experience has convinced me there are more people who think they want to learn programming than people who actually want to learn programming.

All good points.

I agree about programming being sexy and then suddenly people are turned off when they realize how difficult it really is. That is why I would keep this extremely basic.

disregardable1 votes

But why?

FarRockBF1 votes

[{quoted}](name=The AFK Farmer,realm=NA,application-id=cIfEodbz,discussion-id=j0ABkvq6,comment-id=0000,timestamp=2015-05-22T00:49:37.987+0000)

But why?

Because the overwhelming majority wanted: http://boards.na.leagueoflegends.com/en/c/miscellaneous/Ewxdr513-free-vba-scripting-classes-on-lol-forum

FarRockBF1 votes

Bump for morning readers.

FarRockBF1 votes

One last try, otherwise, I'll just dump this effort.

Drunk Rummate1 votes

Posting in here for bookmark purposes. Thanks OP :]

Sorry I'm a bit slow to respond, got a busy schedule. But I for one appreciate your work..!

More from [ARCHIVED] Miscellaneous

More by FarRockBF