插入模块,再插入子程序
敲如下代码
Public Sub vc()
Dim name As String
Dim birth As Date
Dim age As Integer
name = "次里取丁"
birth = "1998-8-1"
age = Year(Now()) - Year(birth)
Debug.Print name & "is" & age & "years old"
End Sub
如图
运行结果为
所以,我已经20岁了,该回村找媳妇啦,,,
插入模块,再插入子程序
敲如下代码
Public Sub vc()
Dim name As String
Dim birth As Date
Dim age As Integer
name = "次里取丁"
birth = "1998-8-1"
age = Year(Now()) - Year(birth)
Debug.Print name & "is" & age & "years old"
End Sub
如图
运行结果为
所以,我已经20岁了,该回村找媳妇啦,,,