PowerPoint Presentation
Chapter 37: Variables and Arrays
Copyright By PowCoder代写 加微信 powcoder
VBA: Defining variables
5 120 =newdowhiledemo(A5)
9 362,880
13 6,227,020,800
VBA: Arrays
All VBA arrays start from 0 unless specified otherwise
MyArray(5) consists of 6 elements
MyArray(0), MyArray(1), MyArray(2), MyArray(3), MyArray(4), MyArray(5)
Array element is treated just like a variable
MyArray(2)
MyArray(i-3) assuming i-3 has an integer value >= 0 and <= 5 for MyArray(5)
VBA: Array – sum range
Array: Sum Range
10 =SumRange(A10:A13)
VBA: Array – sum range with elements to sum
Array: SumRange1
18 =sumrange1(A17:C19,4)
25 =sumrange1(A17:C19,5)
33 =sumrange1(A17:C19,6)
VBA: Array
Array: Demo 1
# 0 # 1 # 4 # 9 # 16 # 25 =arraydemo1()
VBA: Array
Array: Demo 2
0 0 =arraydemo2(A8)
6 #VALUE! <= array set for only 6 variables (0 - 5)
VBA: Array - multidimensional
Multidimensional array
LB 1 0 =arraydemo4(B37,A37)
VBA: Array – Bound of an Excel Range in Function
Bound of an Excel Range
C 2 =rangebound(D17:E21,A17)
c 0 Doesn't work for lower case
r 5 Works for lower case as function converts to uppercase
1 0 Doesn't work for numeric
/docProps/thumbnail.jpeg
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com