3. Learn VBA - SUBS and FUNCTIONS explained
Now we're going to learn what VBA SUBS and FUNCTIONS are.
A SUB is a piece of code that runs something
A FUNCTION is a piece of code that returns something
Now lets see it in action with a real life example:
Your wife asks you the time.
You look at your watch
You tell her the time.
What would this look like in code ?
- If we attach the Sub TellWifeTheTime to a button and then press it, what would happen ?
- the Sub TellWifeTheTime goes away and gets the time from the function WhatTimeIsIt, and then displays the time in a message box
Download practise sheet, and press the button
Subs and Functions explained in this training Video:
- Nick's blog
- Login or register to post comments
- 26375 reads
Recent comments
5 years 41 weeks ago
6 years 27 weeks ago
6 years 39 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 48 weeks ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago