在VBA中转义括号

时间:2018-05-31 13:05:03

标签: excel vba excel-vba

谁能告诉我它为什么不起作用?我已经看过所有主题:连接变量,连接字符串等等。我认为主要原因是"("字符,但我还没有找到逃脱它的方法。

结果应该返回= DATE(2018; 5; 31)+ TIME(15; 40; 0),我的意思是,显示当前日期和时间。非常感谢你。

Sub intertformula()

Dim repYear As Integer
Dim repMonth As Integer
Dim repDay As Integer
Dim repHour As Integer
Dim repMin As Integer

repYear = Year(Date)
repMonth = Month(Date)
repDay = Day(Date)
repHour = Hour(Time)
repMin = Minute(Time)

Range("H3").Formula = "=DATE(" & repYear & ";" & repMonth & ";" & repDay & ")+TIME(" & repHour & ";" & repMin & ";0)"

0 个答案:

没有答案