FULLY QUALIFING VARIABLES Flashcards

1
Q

How do you fully qualify the worksheet and wb objects?

A

Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets (“Sheet1”)

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

Write code where you are wanting to include the last row of data.

A

Dim LastRow As Long
LastRow = ws.Cells(ws.Rows.Count, “A”).End(xlUp).Row

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

What is the purpose of the For….Next statement?

A

It repeats a block of statements a specific number of times:
It will use a Counter Variable whose value can be either increased or decreased with each repetition of the loop.

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

Which VBA function references a single cell at a time?

A

Cells function

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

VBA code: Worksheets(“Sheet1”).Cells - is referencing what?

A

Every single cell in the entire sheet (the only time it doesn’t reference a single cell).

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

What cell does this code reference: Worksheets(“Sheet1”).Cells(3)?

A

C1

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

Write VBA using cell reference for D15.

A

Worksheets(“Sheet1”).Cells(15,4)

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

You can using the actual column letter - do so using cell function for D15:

A

Cells(15, “D”)

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

Are you allowed to use the column letter inside of a cell function?

A

yes

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

Is it a good idea to use a loop with a Range function?

A

No - because the references for cells aren’t numbers.

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

What would be a workaround for using loops and the Range function?

A

You can embed the Cells functions inside of a Range Function.

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

What is the value of using the Cell function inside of a Range function?

A

You can write dynamic code using Loops - using just the Range function does not do this.

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