![]() |
Copy and Paste Formula from ActiveCell to cells in 13 columns priorto the active column
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 |
Copy and Paste Formula from ActiveCell to cells in 13 columns prio
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(). -- Gary''s Student - gsnu200909 "sgltaylor" wrote: 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 . |
All times are GMT +1. The time now is 01:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com