Results 1 to 11 of 11

Copy data from 2 sheets based on date

Threaded View

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

    Copy data from 2 sheets based on date

    Hello all. I have the following code that performs a row copy based on selected dates which is then pasted to another sheet as a report. I need to also perform the same copy from another sheet with the same structure so the All_Report contains the data from both sheets. The name of the other sheet to copy the information from is "Closed_Requests".

            Case "All_Report"
                If IsDate(.Cells(x, "C").Value) And .Cells(x, "C").Value <> "" And .Cells(x, "C").Value >= lodate And .Cells(x, "C").Value <= hidate Then
                    If RowsWithNumbers Is Nothing Then
                    Set RowsWithNumbers = .Cells(x, "C")
             Else
                    Set RowsWithNumbers = Union(RowsWithNumbers, .Cells(x, "C"))
                    End If
                   End If
                End If
    I tried

            Case "All_Report"
                If IsDate(.Cells(x, "C").Value) And .Cells(x, "C").Value <> "" And .Cells(x, "C").Value >= lodate And .Cells(x, "C").Value <= hidate Then
                   If worksheets("Closed_Requests") IsDate(.Cells(x, "C").Value) And .Cells(x, "C").Value <> "" And .Cells(x, "C").Value >= lodate And .Cells(x, "C").Value <= hidate Then
                    If RowsWithNumbers Is Nothing Then
                    Set RowsWithNumbers = .Cells(x, "C")
             Else
                    Set RowsWithNumbers = Union(RowsWithNumbers, .Cells(x, "C"))
                    End If
                   End If
                End If
    This gives me a compile error with the second 'IsDate' hilighted and stating "Expected: Then or GoTo"

    Any help would be appreciated!!

    Thanks,
    Andrew
    Last edited by drewship; 02-11-2010 at 10:56 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