VBA Flashcards

1
Q

For Loops

A

For each i in j (step (x)) %step is optional
….
next i

For i to 10 (step x)
….
next i

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

If loops

A

If not A is nothing then %if A is not empty
…..
end if

if .... then
...
else if .... then
....
end if
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Do while loop

A
Do [while condition]
 [statements]
 [exit do]
 [statement]
loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Do until loop

A
Do [until condition]
 [statements]
 [exit do]
 [statements]
Loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Select case loop

A
select case TESTEXPRESSION
 [case EXPRESSIONLIST 1]
 [statement 1]
 [case EXPRESSIONLIST 2]
 [statement 2]
 ....
 [case else]
 [else statement]
end select
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Select the cells contains constant(or contains formula, or is empty)

A

Set object1=selection.specialcells(xlConstants,xlNumbers)
%object1 equals the range of cells that has number and is constant

Set object2=selection.specialcells(xlCellTypeBlanks)
%object2 equals the range of cells that is empty

Set object3=selection.specialcells(xlFormulas,xlNumbers)
%object3 equals the range of cells that contains number and formula

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

decide whether a cell is empty or not

A

If IsEmpty(cell(i,j).value) then
….
end if

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

select the use range

A

ActiveSheet.UsedRange

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

With Statement

A
With Activecell.font
 .Bold=
 .Color=
 .Name=
 .Size=
 .Italic=
End With 

(same object is select multiple times)

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