+ Reply to Thread
Results 1 to 4 of 4

VBA insert formula

Hybrid View

  1. #1
    Registered User
    Join Date
    04-12-2012
    Location
    Southampton
    MS-Off Ver
    Excel 2007/10
    Posts
    22

    VBA insert formula

    Hello....

    Bit of a basic question from what i understand, however im having major difficulty in doing this.

    What i am trying to do is insert the following
    =(A2 & " " & B2)
    into D2 and the relevant code going down to D1000 so would result in
    =(A1000 & " " & B1000)
    , i thought this could be done using something like
    Range("D2:D1000").Select
      ActiveCells.FormulaR1C1 = " = (RC[-3] &  "" ""  &  RC[-2])"
    but not had any luck.

    Any help you could give would be greatly appreciated.

    Thank you in advance
    Michael

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA insert formula

    simply
    Range("D2:D1000").FormulaR1C1 = "=RC[-3]&"" ""&RC[-2]"
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    04-12-2012
    Location
    Southampton
    MS-Off Ver
    Excel 2007/10
    Posts
    22

    Re: VBA insert formula

    Amazing thank you

  4. #4
    Forum Contributor codeslizer's Avatar
    Join Date
    05-28-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2003 - 2010
    Posts
    245

    Re: VBA insert formula

    Or just change your code from
    ActiveCells.FormulaR1C1 = " = (RC[-3] &  "" ""  &  RC[-2])"
    to
    Selection.FormulaR1C1 = " = (RC[-3] &  "" ""  &  RC[-2])"
    cOdEsLiZeR - Back after a long break.. Let's sLiZe some more cOdEs!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1