add empty space in formula

G

Guest

Hi,

Having some trouble with inserting formula.

Sub formula()
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Range("I1").Select
Selection.Copy
Range("H1").Select
ActiveSheet.Paste
'Range("H2").Select
' Application.CutCopyMode = False
' this is the formula but I get a compile error message end of statement
'activecell.FormulaR1C1 = "=J2&" "&K2"
' I need to put a space between J2 and K2, otherwise the strings
aren't seperated with a space

End Sub


How can I solve this? Or should I
 
G

Guest

activecell.FormulaR1C1 = "=J2&"" ""&K2"


demo'd from the immediate window for confidence:

? "=J2&"" ""&K2"
=J2&" "&K2

so double up double quotes when within double quotes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top