gpt4 book ai didi

VBA - 在串联单元格之间插入空格

转载 作者:行者123 更新时间:2023-12-03 02:28:25 27 4
gpt4 key购买 nike

这段代码对我有用。但是,在目标单元格中​​,我希望 A2 和 B2 的值之间有一个空格:

For j = 1 To lastRow3
If ws.Range("A" & j) = "OKUMA LATHE" Then
Cells(j, lastCol2 + 2).Formula = "=$A2&$B2"
End If
Next j

男孩该做什么?我尝试的所有操作都会出现编译错误...

最佳答案

您需要将 VBA 中的引号加倍

For j = 1 To lastRow3
If ws.Range("A" & j) = "OKUMA LATHE" Then
Cells(j, lastCol2 + 2).Formula ="=$A2 & "" "" & $B2"
End If
Next j

关于VBA - 在串联单元格之间插入空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45765867/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com