Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bara Cohen   on Feb 24 In MS Office Category.

  
Question Answered By: Ryder Anderson   on Feb 24

missed the first bit: "to use vba  to insert a formula  in column  B"

If you record a macro while putting a formula into B1 you get
something like this:

Range("B1").Select
ActiveCell.FormulaR1C1 = "=RC[-1]/2"
Range("B2").Select

(I typed in a formula to halve the cell to the left)
Two things can be done to simplify, first the "=RC[-1]/2" looks a bit
foreign because it's using the R1C1 notation, so that line can be
changed to the more familiar A1 notation thus:

ActiveCell.Formula = "=A1/2"

Second, all this selecting can be removed thus:

Range("B1").Formula = "=A1/2"

so that single line is all that is needed to put a formula into cell B1

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Copy down formula with vba Or get search suggestion and latest updates.


Tagged: