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: Blake Smith   on Feb 24

Range("B1").AutoFill Destination:=Range("B1:B21")

would be the vba  way for known source and destination ranges, you need
to change the Destination range  bit automatically.

Sticking with using activecell, make sure B1 is the Active cell then

ActiveCell.AutoFill Destination:=Range(ActiveCell.Offset(0, -1),
ActiveCell.Offset(0, -1).End(xlDown)).Offset(0, 1)

(it's one line) will fill  down from the active cell row down as far as
there is a contiguous column  to the left.

The following will do the same but use the column to the right of the
active cell to determine how far down to fill:

ActiveCell.AutoFill Destination:=Range(ActiveCell.Offset(0, 1),
ActiveCell.Offset(0, 1).End(xlDown)).Offset(0, -1)

Moving away from using ActiveCell, its appearance in the above
formulae can be replaced with, say, Range("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: