View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JD JD is offline
external usenet poster
 
Posts: 7
Default Formula won't copy and offset as I intend

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
--//

[Apologies, but realised the subject line was gibberish.]