0

Working on a project, I'm having a little issue on copying down values using a loop. i've tried to describe the issue down here as clearly as i can.

-What should be done, is that for each of the i's (1 to 83) and for the whole period (ie 1/1/2014-15/1/2014) values are copied below each other on Calculation sheet. -What is happening so far, is that it copies down values but overwrites all days except for the first, for all i's except for the last.

Hence, the result after the macro is finished is: 1/1/2014 of i1, 1/1/2014 of i2 [...] till 1/1/2014-15/1/2014 for i83. What should be the result is 1/1/2014-15/1/2014 for i1, 1/1/2014-15/1/2014 for i2 [...] till 1/1/2014-15/1/2014 for i83.

Sounds mysterious and unclear, but if here's the code which makes it hopefully more clear.

Sheets("Summary").Select

For i = 1 To 83
    Sheets("Summary").Select
    Sheets("Summary").Range("A10").Value = Sheets("Summary").Cells(i + 10, 1).Value
    Sheets("Calculation").Select
    Sheets("Calculation").Range(Cells(i + 17, 1), Cells(i + 31, 59)).Value = Sheets("Calculation").Range("a2:bg16").Value
    Next i


Range("a1").Select


End Sub

I'm looking forward to your suggestions, if anything is not clear please let me know

Valentino

1 Answers1

0

Question? Do you have observations of 83 item (in 83 columns) for each of the 15 dates (in rows?) or 83 rows of observations of the dates in 15 columns?

Worksheets("Summary").Range("A10:CF24").Copy Destination:=Worksheets("Calculation").Range("A10").Offset(17)
Dan Savage
  • 11
  • 2