How to use square brackets for a string evaluation in VBA?

强颜欢笑 提交于 2019-12-04 08:08:07
jamheadart

From the link in the comment: "Using square brackets (for example, "[A1:C5]") is identical to calling the Evaluate method with a string argument."

I read that to mean:

Evaluate("20+10") is equivalent to [20+10] where the Evaluate function takes the string and converts to a literal interpretation before evaluating.

but ["20+10"] is just equivalent to evaluating a string "20+10"

The reason Debug.Print ["20"+"300"] works is because VBA is great at auto-converting "20" to 20.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!