Do Loop to duplicate active row 'n' times

rambike

New Member
Joined
Feb 24, 2011
Messages
3
To the nearest helper,

I am looking for a method to expand data at a 15 minute timestep to a 1 minute timestep. The goal is to preserve a constant 15 min value (e.g. @ 10:15) for the 15 applicable 1 min timesteps (10:01 - 10:15). Currently I have a macro Do Loop, which duplicates the active row 14 times and inserts it below (between 15 min timesteps). However, this operation performs just one time, so manually running the macro for a week's data is time consuming (See code below)

Code:
Sub AddRow_Click()
Do
   Dim i As Integer
    For i = 1 To 3
  Dim insertBelow As Range
  Dim wks As Worksheet
  Set insertBelow = ActiveCell
  Set wks = insertBelow.Worksheet
  wks.Range("A1").Select
  insertBelow.Offset(1, 0).EntireRow.Insert
  insertBelow.EntireRow.Copy
  wks.Paste insertBelow.Offset(1, 0).EntireRow
  Application.CutCopyMode = False
  Next i
Exit Do
Loop
End Sub
Can this be automated to proceed through each 15 min timesteps?

Or, is there an alternate way to resolve the main issue? (e.g. using VLOOKUP to reference (e.g.) 10:15 15 times, then move onto 10:30...?)

Thanks for your consideration,
Evan
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top