davidmg1982
Board Regular
- Joined
- Oct 12, 2015
- Messages
- 64
I have the following code, that inserts the missing date within column 'ReportDate' until finds todays date:
Problem is it stops when the first todays date if found, and I need it to continue with the rest of the list.
To put it on an example in the table below, its only doing it for "AR" values in CountryCode, and I need it to do the same for the rest of the list: "BR", "CL", etc.. until finds the last value.
Thanks ahead for your guidance.
VBA Code:
Dim i As Long
Dim RowCount As Long
i = 4
Do
If Cells(i, 1) + 1 < Cells(i + 1, 1) Then
Rows(i + 1).Insert
Cells(i + 1, 1) = Cells(i, 1) + 1
End If
If (Cells(i + 1, 1) = "") Then
Cells(i + 1, 1) = Cells(i, 1) + 1
End If
i = i + 1
Loop Until Cells(i, 1).Value >= Date
Problem is it stops when the first todays date if found, and I need it to continue with the rest of the list.
To put it on an example in the table below, its only doing it for "AR" values in CountryCode, and I need it to do the same for the rest of the list: "BR", "CL", etc.. until finds the last value.
Thanks ahead for your guidance.
CountryCode | ReportDate | Value |
AR | 7/22/2021 | 10 |
AR | 7/23/2021 | 10 |
AR | 7/25/2021 | 30 |
AR | 7/26/2021 | 10 |
AR | 7/27/2021 | 30 |
AR | 7/28/2021 | 28 |
AR | 7/29/2021 | 30 |
BR | 7/22/2021 | 59 |
BR | 7/23/2021 | 65 |
BR | 7/24/2021 | 87 |
BR | 7/25/2021 | 96 |
BR | 7/26/2021 | 54 |
BR | 7/27/2021 | 321 |
BR | 7/28/2021 | 5 |
BR | 7/29/2021 | 15 |
BR | 7/30/2021 | 658 |
BR | 7/31/2021 | 85 |
CL | 7/22/2021 | 59 |
CL | 7/23/2021 | 62 |
CL | 7/24/2021 | 32 |
CL | 7/26/2021 | 258 |
CL | 7/27/2021 | 25 |
CL | 7/28/2021 | 58 |
CL | 7/29/2021 | 8 |
CL | 7/30/2021 | 47 |