I'm currently having a problem with my code and i can't find the proper solution for it. The input of this code is 8760 registries with values in from of it. For example in column B there is the 8760 values that correspond to the number of hours in a year and in front of it i have the value for each hour. as i want to have that values in each 15 minutes i need to divide the value by 4 and paste it. So i have in column B the hours, in the column C the value and i want to have in column D the the value divided by 4 so i will have 8760*4 registries.
Option Explicit
Sub test()
Dim i, j As Long
Dim valor As Long
For j = 0 To 8759
For i = 1 To 4
valor = Range("C" & 3 + j).Value
Range("B" & 3 + j).Select
Selection.Copy
Range("H" & 3 + i + j * 4).Select
ActiveSheet.Paste
Range("I" & 3 + i + j * 4) = valor / 4
Next
Next
End Sub
It crashes my program after a while. It runs ok till the crash.