Results 1 to 9 of 9

Macro to copy Data where Date is > Today()

Threaded View

  1. #6
    Registered User
    Join Date
    12-04-2011
    Location
    USA
    MS-Off Ver
    Excel 2000
    Posts
    8

    Re: Macro to copy Data where Date is > Today()

    I am getting an error object required:
        Set CurrentWb = ThisWorkbook
        For Each Ocell In WsTData.Range(WsTData.Cells(2, 18), WsTData.Cells(Rows.Count, 18).End(xlUp))
            If Ocell.Value >= Date Then
                'Set NewWb = Workbooks.Add
                'NewWb.Worksheets("Sheet1").Name = "NewWsName"
                'Set NewWs = NewWb.Worksheets("NewWsName")
                'NewWs.Rows(1).EntireRow.Cells.Value = WsTData.Rows(1).EntireRow.Cells.Value
                Sheets.Add
                Sheets("Sheet1").Select
                Sheets("Sheet1").Name = ("Testing")
                GreaterThanExists = True
                Exit For
            Else
                GreaterThanExists = False
            End If
        Next Ocell
        If GreaterThanExists = True Then
            For Each Ocell In WsTData.Range(WsTData.Cells(2, 18), WsTData.Cells(WsTData.Rows.Count, 18).End(xlUp))
                If Ocell.Value >= Date Then
                    Sheets("Testing").Cells(Testing.Rows.Count, 1).End(xlUp).Offset(1, 0).EntireRow.Cells.Value = Ocell.EntireRow.Cells.Value
                    'NewWs.Cells(NewWs.Rows.Count, 1).End(xlUp).Offset(1, 0).EntireRow.Cells.Value = Ocell.EntireRow.Cells.Value
                End If
            Next Ocell
        End If
    End Sub
    The line of code that it doesn't like is:
    Sheets("Testing").Cells(Testing.Rows.Count, 1).End(xlUp).Offset(1, 0).EntireRow.Cells.Value = Ocell.EntireRow.Cells.Value
    Last edited by MrSmith12; 12-05-2011 at 11:10 PM.

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