1.0 Introduction Flashcards
What is variable?
a symbolic name that can take on different values
▪ a memory location
what is constant
a value
when you open Excel to write a VBA code for the first time, what is the first thing you do?
save the file as “.xlsm” file type or else macros will be lost
▪ m stands for macro-enabled
what are macros?
short programs that carry out usually non-mathematical operations
-eg. formatting and filling cells with values
* often executed with short-cut keystrokes to achieve desired result easily and quickly
* example: computer codes behind many of toolbar tools on Word and Excel are macros
* generally people use word “macro” to mean any computer program
what are subs?
most general purpose
* offers most flexibility
* can be written with or without any parameters (except for main Sub program)
* can use graphical user interface (GUI) to get info from user
* can contain sequence of mathematical operations
- eg. decisions and loops
functions
short programs that can carry out mathematical operations
* but can also be used for non-mathematical operations
* except for a few, functions require parameters
* all functions return a result
* since functions always return a result, they can be used in formula on the worksheet, in
macros, and in subs
what can you do with vba
with VBA, create ONE workbook that can be used repeatedly for different values of inputs
what is VBA
Visual Basic for Applications. A programming language that expands and enhances the problem. Solving capabilities of Excel.
How to get to VBA in Excel?
In Excel > File > Options > Customize Ribbon > Select Devloper
Which windows are open when you open VBA and what are they?
Project/project explorer
-contains the components of your project
Properties window
-contains the properties of the components of your project
what happens when you insert a new module =>
a corresponding code window appear with project explorer and properties
where can you rename your module?
Properties
Decision
conditional execution of statements
Loop
performs the same calculation over and over again over a range of values of a certain parameter
what is computer program
a set of instructions to the computer
-instructions must be given in sequence without ambiguity
-fast but has no intelligence
-needs input information to provide output