When I use =
TRIM(CONCATENATE(AK2," ",AQ2)) and drag down, it works fine
but I need to use this in a macro and when I use
Sub SetCode()
Range("AP2").Select
ActiveCell.FormulaR1C1 = _
"=TRIM(CONCATENATE(AK2," ",AQ2))"
FillDown
End Sub
I'll get a compile error * Expected: end of statement
If I change the code to
"=TRIM(CONCATENATE(AK2,"" "",AQ2))"
I get past the error and the macro will run but it will change the code to
"=TRIM(CONCATENATE('AK2'," ",'AQ2'))"
and it just fills the column with the #NAME
Can anyone tell me how to fix this ?
>"=TRIM(CONCATENATE(AK2,""
>I get past the error and the macro will run
and it should be like this indeed.
if you look after the code, the value in the cell will be indeed:
=TRIM(CONCATENATE(AK2," ",AQ2))
the "" in the vba code is only because " is already a string delimiter, and the duplicated double quotes is to "escape" the double quotes.