VBA to insert a carriage return after existing text and paste more text

29,286

Try activecell.FormulaR1C1 = activecell.FormulaR1C1 & Chr(10) & "MEASURE_1"

Share:
29,286

Related videos on Youtube

RocketGoal
Author by

RocketGoal

Updated on September 18, 2022

Comments

  • RocketGoal
    RocketGoal over 1 year

    I'm adding "Measure_1" within certain cells. This requires me to double click in the cell, go to the end of the existing text, insert a carriage return (alt+ent), and then paste in MEASURE_1. Therefore, I'm trying to automate this.

    Unfortunately my VBA code below is overwriting the existing text with the example I used when recording my macro.

    activecell.FormulaR1C1 = "D4)" & Chr(10) & "MEASURE_1"
    

    How do I make it say:

    activecell.FormulaR1C1 = **ANY TEXT WITHOUT CHANGING** & Chr(10) & "MEASURE_1"
    

    Many thanks. Michael.