Hi MrExcel troops,
My time has finally come to ask a question rather than rely on all the answers as I'm having a brain freeze moment!
I've got a dataset showing the input table on the left & the output table on the right. The first date range interates as I'd expect, however I can't get the next rows to iterate their date ranges or indeed the other cells to be populated. Step 1 is to get the dates to iterate.
Creating the mini-sheet keeps crashing my Excel, so here's the input and output table:
What I'm trying to achieve:
My time has finally come to ask a question rather than rely on all the answers as I'm having a brain freeze moment!
I've got a dataset showing the input table on the left & the output table on the right. The first date range interates as I'd expect, however I can't get the next rows to iterate their date ranges or indeed the other cells to be populated. Step 1 is to get the dates to iterate.
VBA Code:
Sub GenerateDates()
Application.ScreenUpdating = False
Dim i, j As Integer
Dim finalRow, finalRow2, startRow As Long
finalRow = Range("A" & Rows.Count).End(xlUp).Row
finalRow2 = Range("M" & Rows.Count).End(xlUp).Row
For i = 2 To 4 'finalRow
finalRow2 = Range("M" & Rows.Count).End(xlUp).Row
startRow = finalRow2 + 1
Range("M" & startRow) = Range("A" & i)
j = i
Days = Int((Range("B" & i) - Range("A" & i)))
Do While j < 2 + Days
j = j + 1
Range("M" & j) = Range("M" & j - 1) + 1
Loop
Range("N" & startRow) = Range("C" & i)
Range("O" & startRow) = ""
Range("P" & startRow) = Range("F" & i)
Range("Q" & startRow) = Range("G" & i)
Next i
End Sub
Creating the mini-sheet keeps crashing my Excel, so here's the input and output table:
What I'm trying to achieve: