我截取字符串的时候,提取的不完整。
理论上 我 "+" & range("a4").value & "+" & range("c2").value,该等于+0.25+0.25 。
可是取值的时候c2的值总是".25".其余单元格取值都正常。全是字符串。
代码如下
For jcell = 2 To 9
For icell = 10 To 36
If Sheet1.Cells(icell, jcell).Value <> "" Then
Sheet2.Cells(icell, jcell + 10).Value = string1 & Sheet1.Cells(icell, 1).Value & string2 & Left(Sheet1.Cells(9, jcell), 4)
End If
Next
Next
只有 c2单元格取值不完整。
可能是C2单元格和其他单元格格式不同导致的,C2单元格是纯数字格式,而A4单元格是以文本形式存储的数值。
在VBA中测试如下
Debug.Print "+" & Range("a4").Value & "+" & Range("c2").Value后者比前者在单元格内部多了一个引号。
温馨提示:答案为网友推荐,仅供参考