+ Reply to Thread
Results 1 to 2 of 2

Check for current date in a row

  1. #1
    sd
    Guest

    Check for current date in a row

    I know this is simple but I cant get it right. I have a report that I
    only want to update if the data is not already there. Right now if the
    last row is the same as the date on the report things work well. But if
    the report is run with a date that has already been run it adds this
    data.
    How do I check row a to see if the date is there?

    Sub KeepRecords()

    'Check sheet ("MTD").Range (A:A) If value is same as("REPORT"). range
    ("P1") date GoTo end sub.
    'If value different add data from REPORT sheet.

    Application.ScreenUpdating = False

    Dim LastRow As Object
    Set LastRow = Sheets("MTD").Range("A65536").End(xlUp)

    If LastRow = Sheets("Report_Date").Range("D3") Then GoTo 1

    Dim NextRow As Object
    Set NextRow = Sheets("MTD").Range("A65536").End(xlUp)

    With NextRow
    .Offset(1, 0) = Sheets("Report").Range("P1")
    .Offset(1, 1) = Sheets("Report").Range("C4")
    .Offset(1, 2) = Sheets("Report").Range("C5")
    .Offset(1, 3) = Sheets("Report").Range("C6")
    .Offset(1, 4) = Sheets("Report").Range("G4")
    .Offset(1, 5) = Sheets("Report").Range("G5")
    .Offset(1, 6) = Sheets("Report").Range("G6")
    .Offset(1, 7) = Sheets("Report").Range("G7")
    .Offset(1, 8) = Sheets("Report").Range("I6")
    End With
    1
    End Function


  2. #2
    Ardus Petus
    Guest

    Re: Check for current date in a row

    If Not Worksheets("MTD").Range("A:A").Find( _
    What:=Worksheets("REPORT").Range("P1"), _
    XlSearchOrder:=xlByColumns _
    ) Is Nothing Then Exit Sub

    HTH
    --
    AP

    PS: you Sub ends with End Function. Should be End Sub

    "sd" <[email protected]> a écrit dans le message de
    news:[email protected]...
    > I know this is simple but I cant get it right. I have a report that I
    > only want to update if the data is not already there. Right now if the
    > last row is the same as the date on the report things work well. But if
    > the report is run with a date that has already been run it adds this
    > data.
    > How do I check row a to see if the date is there?
    >




+ 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