I have a code below which concatenate Values in A and B columns. When I want to add an empty space between A and B which is an Excel formula
=CONCATENATE(A4," ",B4) or =A4 & " " & B4
the macro would flag it as an error when using VBA:
With ws3.Range("E4:E" & LastRow3)
.Formula = "=A4&B4"
End With
Quotes within quotes need to be doubled
.Formula = "=A4 & "" "" & B4"
and this will result in =A4 & " " & B4 as a formula.
This appears to work:
Sub jhgfd()
Set ws3 = ActiveSheet
LastRow3 = 10
With ws3.Range("E4:E" & LastRow3)
.Formula = "=A4 & CHAR(32) & B4"
End With
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With