Filling up the missing Dates (Excel 2010)

mzalikhan

Board Regular
Joined
May 16, 2011
Messages
62
Hi everybody

Here is my question. I have got "Daily" weather data for "Ten Years". So Column A is date, B, C, .......H are the different parameters. For ten years, its around 3650 rows.

Problem here is that some days are missing. For example after 5-August-2001 the next data entry is 17-August-2001, but there are no empty rows for the missing dates. I need to put the empty rows with the dates in Column A for the missing dates.

Peace
Muhammad Zeeshan
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try this mzalikhan:

Sub Fill_Out_Dates()
'
Cells(65000, 1).Select ' 1 is column A etc.
Selection.End(xlUp).Select

Do While (ActiveCell.Value <> "") And (ActiveCell.Row > 1)
If (ActiveCell.Value - 1 <> Cells(ActiveCell.Row - 1, 1).Value) Then
ActiveCell.EntireRow.Insert Shift:=xlDown
ActiveCell.Value = Cells(ActiveCell.Row + 1, 1).Value - 1
Else
Cells(ActiveCell.Row - 1, 1).Select
End If
Loop
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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