Results 1 to 8 of 8

Copy rows to new sheet based on date range selected on a form

Threaded View

  1. #3
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Press a button to open form, total and average of items, pivot table

    Thanks Spreadsheet_Booster, This is something for work so I do not have IM capability.

    I have worked on it some more and hope someone can help with this code:

        On Error Resume Next
            ws2.Name = dtselect4
        On Error GoTo 0
            With ws1
        LR = .Range("A" & Rows.Count).End(xlUp).row
        .Rows("1:2").Copy Destination:=ws2.Range("A1")
        j = 2
        For i = 3 To LR
            With .Range("A" & i)
                If .Range("D") >= lodate And .Range("D") <= hidate Then
                    j = j + 1
                    .EntireRow.Copy
                    ws2.Range("A" & j).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
                End If
            End With
        Next i
    End With
    Application.CutCopyMode = False
    In the uploaded example, I want to press the button on the Utilities tab, select dates from May 7th to May 11th, name the sheet, and press Start.

    When Start is pressed, I want to copy the first 2 rows over as the header to a new sheet (which was named in the form) and then copy every row that has a date in column "D" that is between or equal to the dated selected in the form. In this case, the Example tab contains the desired output. All new tabs should be placed at the end.

    The actual output was the test2 tab. Can someone help me tweak this?

    Thanks,
    Andrew
    Attached Files Attached Files
    Last edited by drewship; 05-11-2009 at 08:09 AM. Reason: clarification of tab placement

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