Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy Multiple Columns, Paste Under a Single column | Excel Worksheet Functions | |||
Bug - Programmatic copy/paste other sheet to activecell | Excel Programming | |||
How I can copy / paste a selected cells to other columns in Excel | Excel Discussion (Misc queries) | |||
How do I set up a copy and paste formula with ascending columns | New Users to Excel | |||
Paste Cells in Column A to Columns B-K | Excel Programming |