Transform hourly data in minute timestep data - Solved
I have an Excel file with hourly data, that is 8760 values on one year.
I need to have data at the minute-step.
I need to take the hourly value, and copy it to the 60 cells over and over again, until I have 525 600 values, being my minute timestep.
I'veI tried a couple things already, but haven't been able to do anything else than copy/paste it by hand, which is going to take long...
Sub test()
Worksheets("MySheet").Activate
Dim i As Double 'minutes increment
Dim j As Integer 'hourly increment
Dim k As Double
k = 0 'initialization of k
Dim Var1 As Single
Dim Var2 As Single
For j = 1 To 8760
Var1 = Cells(j, 8).Value 'Row "j"/from 1 to 8760, column "8"/H --> hourly values
Var2 = Cells(j, 7).Value 'Row "j"/from 1 to 60, column "7"/G --> minutes values
For i = 1 To 60
k = k + 1 'incrementation of k to be able to insert the values in the 60 cells (corresponding to 60 minutes)
Cells(k + 3, 10) = Var1 'insert those values in the 10th column (J)
Cells(k + 3, 9) = Var2 'insert those values in the 10th column (I)
Next i
Next j
End Sub
Sub test()
Worksheets("MySheet").Activate
Dim i As Double 'minutes increment
Dim j As Integer 'hourly increment
Dim k As Double
k = 0 'initialization of k
Dim Var1 As Single
Dim Var2 As Single
For j = 1 To 8760
Var1 = Cells(j, 8).Value 'Row "j"/from 1 to 8760, column "8"/H --> hourly values
Var2 = Cells(j, 7).Value 'Row "j"/from 1 to 60, column "7"/G --> minutes values
For i = 1 To 60
k = k + 1 'incrementation of k to be able to insert the values in the 60 cells (corresponding to 60 minutes)
Cells(k + 3, 10) = Var1 'insert those values in the 10th column (J)
Cells(k + 3, 9) = Var2 'insert those values in the 10th column (I)
Next i
Next j
End Sub
This can also be done without VBA, as given in answer, with the function =INDEX.
Thanks for your help !
Transform hourly data in minute timestep data - Solved
I have an Excel file with hourly data, that is 8760 values on one year. I need to have data at the minute-step. I need to take the hourly value, and copy it to the 60 cells over and over again, until I have 525 600 values, being my minute timestep.
I've tried a couple things already, but haven't been able to do anything else than copy/paste it by hand, which is going to take long...
Sub test()
Worksheets("MySheet").Activate
Dim i As Double 'minutes increment
Dim j As Integer 'hourly increment
Dim k As Double
k = 0 'initialization of k
Dim Var1 As Single
Dim Var2 As Single
For j = 1 To 8760
Var1 = Cells(j, 8).Value 'Row "j"/from 1 to 8760, column "8"/H --> hourly values
Var2 = Cells(j, 7).Value 'Row "j"/from 1 to 60, column "7"/G --> minutes values
For i = 1 To 60
k = k + 1 'incrementation of k to be able to insert the values in the 60 cells (corresponding to 60 minutes)
Cells(k + 3, 10) = Var1 'insert those values in the 10th column (J)
Cells(k + 3, 9) = Var2 'insert those values in the 10th column (I)
Next i
Next j
End Sub
This can also be done without VBA, as given in answer, with the function =INDEX.
Thanks for your help !
Transform hourly data in minute timestep data
I have an Excel file with hourly data, that is 8760 values on one year.
I need to have data at the minute-step.
I need to take the hourly value, and copy it to the 60 cells over and over again, until I have 525 600 values, being my minute timestep.
I tried a couple things, but haven't been able to do anything.
Sub test()
Worksheets("MySheet").Activate
Dim i As Double 'minutes increment
Dim j As Integer 'hourly increment
Dim k As Double
k = 0 'initialization of k
Dim Var1 As Single
Dim Var2 As Single
For j = 1 To 8760
Var1 = Cells(j, 8).Value 'Row "j"/from 1 to 8760, column "8"/H --> hourly values
Var2 = Cells(j, 7).Value 'Row "j"/from 1 to 60, column "7"/G --> minutes values
For i = 1 To 60
k = k + 1 'incrementation of k to be able to insert the values in the 60 cells (corresponding to 60 minutes)
Cells(k + 3, 10) = Var1 'insert those values in the 10th column (J)
Cells(k + 3, 9) = Var2 'insert those values in the 10th column (I)
Next i
Next j
End Sub
This can also be done without VBA, as given in answer, with the function =INDEX.
I have an Excel file with hourly data, that is 8760 values on one year. I need to have data at the minute-step. I need to take the hourly value, and copy it to the 60 cells over and over again, until I have 525 600 values, being my minute timestep.
I've tried a couple things already, but haven't been able to do anything else than copy/paste it by hand, which is going to take long...
Update/Solution :
Sub test()
Worksheets("MySheet").Activate
Dim i As Double 'minutes increment
Dim j As Integer 'hourly increment
Dim k As Double
k = 0 'initialization of k
Dim Var1 As Single
Dim Var2 As Single
For j = 1 To 8760
Var1 = Cells(j, 8).Value 'Row "j"/from 1 to 8760, column "8"/H --> hourly values
Var2 = Cells(j, 7).Value 'Row "j"/from 1 to 60, column "7"/G --> minutes values
For i = 1 To 60
k = k + 1 'incrementation of k to be able to insert the values in the 60 cells (corresponding to 60 minutes)
Cells(k + 3, 10) = Var1 'insert those values in the 10th column (J)
Cells(k + 3, 9) = Var2 'insert those values in the 10th column (I)
Next i
Next j
End Sub
This can also be done without VBA, as given in answer, with the function =INDEX.
Thanks for your help !
I have an Excel file with hourly data, that is 8760 values on one year. I need to have data at the minute-step. I need to take the hourly value, and copy it to the 60 cells over and over again, until I have 525 600 values, being my minute timestep.
I've tried a couple things already, but haven't been able to do anything else than copy/paste it by hand, which is going to take long...
Update/Solution :
Sub test()
Worksheets("MySheet").Activate
Dim i As Double 'minutes increment
Dim j As Integer 'hourly increment
Dim k As Double
k = 0 'initialization of k
Dim Var1 As Single
Dim Var2 As Single
For j = 1 To 8760
Var1 = Cells(j, 8).Value 'Row "j"/from 1 to 8760, column "8"/H --> hourly values
Var2 = Cells(j, 7).Value 'Row "j"/from 1 to 60, column "7"/G --> minutes values
For i = 1 To 60
k = k + 1 'incrementation of k to be able to insert the values in the 60 cells (corresponding to 60 minutes)
Cells(k + 3, 10) = Var1 'insert those values in the 10th column (J)
Cells(k + 3, 9) = Var2 'insert those values in the 10th column (I)
Next i
Next j
End Sub
Thanks for your help !
I have an Excel file with hourly data, that is 8760 values on one year. I need to have data at the minute-step. I need to take the hourly value, and copy it to the 60 cells over and over again, until I have 525 600 values, being my minute timestep.
I've tried a couple things already, but haven't been able to do anything else than copy/paste it by hand, which is going to take long...
Update/Solution :
Sub test()
Worksheets("MySheet").Activate
Dim i As Double 'minutes increment
Dim j As Integer 'hourly increment
Dim k As Double
k = 0 'initialization of k
Dim Var1 As Single
Dim Var2 As Single
For j = 1 To 8760
Var1 = Cells(j, 8).Value 'Row "j"/from 1 to 8760, column "8"/H --> hourly values
Var2 = Cells(j, 7).Value 'Row "j"/from 1 to 60, column "7"/G --> minutes values
For i = 1 To 60
k = k + 1 'incrementation of k to be able to insert the values in the 60 cells (corresponding to 60 minutes)
Cells(k + 3, 10) = Var1 'insert those values in the 10th column (J)
Cells(k + 3, 9) = Var2 'insert those values in the 10th column (I)
Next i
Next j
End Sub
This can also be done without VBA, as given in answer, with the function =INDEX.
Thanks for your help !