ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula offscopy and offset (https://www.excelbanter.com/excel-programming/353326-formula-offscopy-offset.html)

JD

Formula offscopy and offset
 
Hi,

I am trying to get the sum of three cells (always the same amount of
columns apart; J10, S10, AB10) on a different spreadsheet onto another
spreadsheet (in the same workbook) and then automatically apply this
same process, selecting another sequence moved to start the same amount
of columns again (AK10, AT10, BC10), but moved nine columns on the
destination spreadsheet.

My code is below, but it only moves the formula copy to S10, AB10,
AK10.

Any help would be appreciated.
//--
Dim Lastrow As Long

Sheets("Sheet2").Activate
Lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
Range("L4").Select
Range("L4").Formula = "=SUM(Score!J10,Score!S10,Score!AB10)"
Range("L4:L" & Lastrow).FillDown
Set rngCopy = Range("L4:L" & Lastrow)
Set rngPaste = Range("U4")
For n = 1 To 4
rngCopy.SpecialCells(xlCellTypeFormulas, 23).Copy
rngPaste.PasteSpecial Paste:=xlPasteFormulas
Set rngPaste = rngPaste.Offset(0, 9)
Next n
Set rng = Range(Range("L4"), Range("L4").End(xlDown))
For i = 0 To 27
rng.Offset(0, 9).FillDown
Next
--//



All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com