我在压缩2个字符串时遇到了一些麻烦。这是我在做什么:
Dim bound1 As String
Dim bound2 As String
bound1 = "E6:E" & 6 + tTest_Threshold
bound2 = "E" & 6 + index1 & ":E" & 6 + index2
Worksheets(chipSheet1).Cells(currIteration + 7, 5).FormulaR1C1 = "=TTEST(" & bound1 & "," & bound2 & ",2,1)"
但是,它正在打印:
=TTEST('E6':'E12','E8':'E14',2,1)
我不明白,为什么在Excel公式中打印
"'"
。知道我在代码中做错了什么吗?谢谢
最佳答案
用
Worksheets(chipSheet1).Cells(currIteration + 7, 5).Formula = "=TTEST(" & bound1 & "," & bound2 & ",2,1)"
代替
Worksheets(chipSheet1).Cells(currIteration + 7, 5).FormulaR1C1 = "=TTEST(" & bound1 & "," & bound2 & ",2,1)"
关于excel - VBA中的字符串连接错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15681924/