|
本帖最后由 aoe1981 于 2019-11-24 16:00 编辑
为了辅助理解引号的叠加作用,我测试了以下代码:
- Sub ss()
- a = 3
- b = 4
- c = 2
- Range("a1") = Evaluate("=3+5")
- Range("a2") = "=3+5"
- Range("a3") = Evaluate("3+5")
- Range("a4") = "3+5"
- Range("b1") = Evaluate("""")
- Range("b2") = """"
- Range("b3") = Evaluate("""""")
- Range("b4") = """"""
- Range("b5") = Evaluate("""""""")
- Range("b6") = """"""""
- Range("b7") = """ & 3 & """
- Range("b8") = """" & 3 & """"
- Range("b9") = """ & cheng(" & """$1""" & "," & """$2""" & "," & 2 & ") & """
- Range("b10") = """ & cheng(" & 3 & "," & 4 & "," & 2 & ") & """
- Range("b11") = Evaluate("""=cheng(3,4,2)""")
- Range("b12") = Evaluate("""=cheng(a,b,c)""")
- Range("b13") = Evaluate("""=cheng(" & a & "," & b & "," & c & ")""")
- End Sub
- Sub ssss()
- Range("c1") = "a2"
- Range("c2") = """a2"""
- Range("c3") = """""a2"""""
- End Sub
复制代码
前三点规律是肯定的:
1.引号必须成对出现;
2.引号内部连用的两个引号会执行为一个引号;
3.变量名中自带引号时,比如:"$1",则应当输入为:"""$1""";
4.……待补充
代码测试结果一道附录如下:
其中的自定义函数是:
- Function cheng(a, b, c)
- cheng = a & b * c
- End Function
复制代码
算是备注的学习笔记吧。
|
评分
-
2
查看全部评分
-
|