从datex开始并在datey结束创build单元格

我有一个我正在处理的Excel电子表格,它根据date/时间从数据库中查找数据。 我有一个设置的开始date/时间的行,并希望创build一个脚本或macros,将自动复制该行,我将它称为引导行,并添加x分钟,直到它达到一个结束时间。

我需要复制整个引导行(第5行)添加x分钟(您可以在单元格D3中定义)并复制它们,直到时间值(位于每行的G列)等于结束时间(位于G2)。

在OP期间OP中添加的转移回答问题无法发布自己的回答:

这是我从我的问题的有用链接中得出的代码:

Sub PopCells() ' Define Variables Dim RowLast As Long 'Last Row with Data in it Dim CpRange As String 'Holds range of data to select when using a variable ' Find the Last Row with Data in it RowLast = ActiveSheet.Cells(Rows.Count, "H").End(xlUp).Row ' Clear out old range of data Let CpRange = "H6:ZZ" & RowLast ActiveSheet.Range(CpRange).Select Selection.ClearContents ' Set the current row to the first row with Data CrRow = 5 ' Loop copies the current row, pastes it to the following row ' And increments the time frame by the time increament value While Cells(CrRow, "H") <= [G2] ' Select the entire current row Let CpRange = "H" & CrRow & ":" & "ZZ" & CrRow ActiveSheet.Range(CpRange).Select 'Copy Selected Row Selection.Copy ' Increment to the Next Row CrRow = CrRow + 1 ' Select the entire current row Let CpRange = "H" & CrRow & ":" & "ZZ" & CrRow ActiveSheet.Range(CpRange).Select ' Paste in copied row ActiveSheet.Paste ' Update time ActiveSheet.Cells(CrRow, "H") = ActiveSheet.Cells(CrRow - 1, "H") + [$D$3] / 1440 Wend End Sub