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

VBA - Inserting a space between concatenated cells

这段代码对我有用。但是,在目标单元格中​​,我想要一个介于 A2 和 B2 的值之间的 space:

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