Copy and Paste Formula from ActiveCell to cells in 13 columns priorto the active column

  • Thread starter Thread starter sgltaylor
  • Start date Start date
S

sgltaylor

Hi All,

I have a sum formula in cell Z30. I am trying to figure out how to
copy the sum formula and paste it into the 13 columns immediately
before column Z. The trick is that I will not always be starting from
column Z and not always on the same row either. At times, it may be
column AA10 or AD50 etc so the code need to be able handle this.

Any ideas?

Thanks,

Steve
 
Sub CopyFormula()
Set r1 = ActiveCell
rr = r1.Row
rc = r1.Column
Set r2 = Range(Cells(rr, rc - 1), Cells(rr, rc - 13))
r1.Copy r2
End Sub

This will copy the active celll to the 13 cells immediate adjacent to the
left. There is a shorter method using Offset().
 
Back
Top