定义变量:
dim 变量名 as 类型:模块级或过程级 类似private
public 变量名 as 类型:多个模块使用
static 变量名 as 类型:静态变量,只有关闭工作薄后释放
手工释放变量 set a = nothing
过程级 --> 过程结束时释放
模块级,工程机 --> 工作薄关闭时释放
定义常量:const 常量名 as 类型=常量值
数据类型 存储空间 数值范围
Byte 1字节 0 - 255
Booleam 2字节 True或者False
Integer 2字节 -32768 - 32767
Long(长整型) 4字节 -2147483648 - 2147483647
Single 4字节 负值范围:-3.402823E38 - -1.401298E-45
正值范围:1.401298E-45 - 3.402823E38
Double 8字节 负值范围:-1.79769313486232E308 - -494065645841247E-324
正值范围:4.94065645841247E-324 - 1.79769313486232E308
Currency 8字节 -922337203685477 - 922337203685477
Decimal 14字节 不包括小数时:+/-79228162514264337593543950335
包括小数时:+/7.9228162514264337593543950335
Date 8字节 1000年1月1日 - 9999年12月31日
Object 4字节 任何引用对象
String(长字符串) 10字节+1字节/字符 0 - 约20亿
String(固定长度) 字符串的长度 1 - 约65400
Varient(数字) 16字节 Double范围内的任何数值
Varient(文本) 22字节+1字节/字符 数据范围和变长字符串相同
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24751738/viewspace-710804/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24751738/viewspace-710804/