+ Reply to Thread
Results 1 to 3 of 3

Inserting Blank Rows after Specific Dates

Hybrid View

Undy Inserting Blank Rows after... 10-22-2012, 02:40 PM
oeldere Re: Inserting Blank Rows... 10-22-2012, 02:58 PM
AB33 Re: Inserting Blank Rows... 10-22-2012, 04:15 PM
  1. #1
    Registered User
    Join Date
    10-15-2012
    Location
    Georgia, USA
    MS-Off Ver
    2007
    Posts
    2

    Inserting Blank Rows after Specific Dates

    I shall attempt to attach a worksheet with a column of dates (column A). I'm not including any of the other data that are a part of the worksheet, as it shouldn't be necessary for the purposes of the example.

    I am wanting a Macro that will run through the date column and insert a blank row between specified date ranges. I need this as I am trying to get a blank line at the end of a 28 day work cycle so I can calculate overtime versus straight time for law enforcement pay calculations.

    I want a blank row inserted after 08/30/2009, 09/27/2009, 10/25/09, 11/22/2009, 12/20/2009 and 01/17/2010. You will note that these specific dates are not necessarily in the column of dates.

    Thanks in advance for any help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Inserting Blank Rows after Specific Dates

    I think you don't need a macro for that.

    Just a few normal formula and a pivot table.

    See if this helps.

    See the attached file.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Inserting Blank Rows after Specific Dates

    It is not a good looking code,but it does the job.

    Sub insert_rows2()
        Dim i As Long, LR As Long
        LR = Cells(Rows.Count, "A").End(xlUp).Row
        If LR < 1 Then Exit Sub
        For i = LR To 1 Step -1
            If Cells(i, 1) = DateValue("08/30/2009") Or Cells(i, 1) = DateValue("09/27/2009") Or Cells(i, 1) = DateValue("10/25/09") _
            Or Cells(i, 1) = DateValue("11/22/2009") Or Cells(i, 1) = DateValue("12/20/2009") Then
                
                Rows(i).Insert xlShiftDown
            End If
        Next i
    End Sub

+ Reply to Thread

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