-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.bas
65 lines (46 loc) · 1.39 KB
/
functions.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
option explicit
global curRow as long
global curCol as long
sub main() ' {
curRow = 2
enterText "Some Text"
enterText 42
enterText "2019-02-17"
enterText "TRUE"
enterText "'TRUE"
curRow = curRow + 1 ' Leave empty
enterText "=NA()"
enterText "=inexistingFunc()"
enterText "=7/0"
enterText "=d2"
enterText "="""""
curCol = 3
addFormula "type" , false
addFormula "isText" , true
addFormula "isNonText" , true
addFormula "isLogical" , true
addFormula "isErr" , true
addFormula "isNumber" , true
' addFormula "isEmpty" , true
addFormula "isNA" , true
addFormula "isFormula" , true
addFormula "isBlank" , true
addFormula "isRef" , true
dim c as long: for c = 2 to curCol
columns(c).autofit
next c
end sub ' }
sub enterText(text as string) ' {
curRow = curRow + 1
cells(curRow, 2) = "'" & text
cells(curRow, 3) = text
end sub ' }
sub addFormula(formula as string, showTrue as boolean) ' {
curCol = curCol + 1
cells(2, curCol) = formula
formula = formula & "(RC3)"
if showTrue then
formula = "if(" & formula & ", unichar(10003) , """")" ' unichar(…) to insert a character from the full unicode range.
end if
range(cells(3, curCol), cells(curRow, curCol)).FormulaR1C1 = "=" & formula
end sub ' }