Results 1 to 4 of 4

Fill Missing Dates in Sequence

Threaded View

  1. #1
    Registered User
    Join Date
    10-07-2010
    Location
    Brisbane
    MS-Off Ver
    Excel 2003
    Posts
    7

    Fill Missing Dates in Sequence

    Hi,
    Sample workbook attached.

    I have the following code to insert rows where date is missing. It works great for the first few instances of a missing date, but ignores instances towards the bottom of the list. Can any one help please?

    Sub fill_dates()
    
    
    Dim lngBottomRow As Long
    Dim blnContinue As Boolean
    Dim i As Integer
    
    
    
    blnContinue = True
    
    Do Until blnContinue = False
        lngBottomRow = ActiveSheet.Range("A65536").End(xlUp).Row
        blnContinue = False
        For i = 3 To lngBottomRow
            If ActiveSheet.Cells(i, 1).Value - ActiveSheet.Cells(i - 1, 1).Value > 1 Then
                ActiveSheet.Rows(i).Insert Shift:=xlShiftDown
                ActiveSheet.Cells(i, 1).Value = ActiveSheet.Cells(i - 1, 1).Value + 1
        
            End If
        Next i
    Loop
    
    End Sub
    Kind regards
    Attached Files Attached Files
    Last edited by dirge; 10-19-2010 at 06:34 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1