VBA Promming入门教程——变量的使用

数据类型

VBA中的数据类型可分为两种

示例

String

1 Sub Main
2     Dim s as string
3     s = "Hello"
4     msgbox(s)
5 End Sub

Single和Double

1 Sub Main
2     Dim a as Single
3     Dim b as Double
4     a = 10 /3
5     b = 10 / 3
6     MsgBox(a)    '3.333333'
7     MsgBox(b)    '3.33333333333333'
8 End Sub

注:VBA注释符号是单引号

参考链接:https://www.guru99.com/vba-data-types-variables-constant.html

 

posted @ 2018-10-03 23:56  Rogn  阅读(375)  评论(0编辑  收藏  举报