![]() |
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 |
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" a écrit dans le message de ups.com... 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? |
All times are GMT +1. The time now is 07:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com