3.0 Record Macro Functions, Debugging and testing, V-Lookup function Flashcards

1
Q

Recording Macros

A

to develop a macro is to write it directly in VBA
- when you record a macro, VBA code automatically generated
- two main purposes
- to automate a sequence of Excel command used repeatedly;
- to learn how to write VBA code
- by recording macro we can obtain necessary instructions or syntax to do specific task in VBA
- eg. want to learn how to move (select) cell below relative to active cell
▪ select “Relative References” in toolbar (Developer > Code > Use Relative Reference)
▪ click “record macro”
▪ click down arrow once in worksheet
▪ click “stop recording”
▪ look at macros created and find related line
- example on right: this statement sets number format of a cell to scientific notation with two decimal places

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

debugging and testing

A

process of hunting down and correcting errors (bugs)
- three major varieties of errors
- syntax errors
- executive (run-time) errors
- logic errors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

three major varieties of errors

debugging and testing

A

syntax errors
executive (or run-time) errors
logic errors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

passive debugging

A

debug button interrupts program execution and puts you into break mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

active debugging

A

by pressing F8 key (or Fn F8) you are stepping through the program
- to stop execution of program at particular location set up a breakpoint by pressing F9 (or Fn F9) or click
on the margin
- to remove breakpoint, click the dot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

syntax errors

A

violate spelling conventions, placement of parentheses, number formatting, etc
▪ eg. Compile error: Invalid character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

executive (or run-time) errors

A

result when a statement attempts an invalid operation
▪ eg. Run-time error ‘11’: Division by zero

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

logic errors

A

due to faulty program logic (garbage in, garbage out)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Vlookup

A

vertical (top to bottom)
- looks up value in LEFT column of a table, jumps to column N of the table (the matched column is column 1) and returns value in that location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

hlookup

A

horizontal (left to right)
- looks up value in top row of a table, jumps down to row N of same table (same column) and returns value
in that location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Message box display

A

Msg = “Do you want to continue?”
Style = vbYesNo + vbQuestion + vbDefaultButton2
Title = “MsgBox DEMO”
Response = MsgBox(Msg, Style, Title)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Input Box Display

A

Msg = “Please enter the length of the beam”
Length = InputBox (Msg, “Length (m)”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly