• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Pick the value if the date reached specific date

Tharabai

Member
I have sheet1 and sheet2 with the same rows and columns.

In column P of sheet 1 I have a date say 12.12.2014. In sheet 2, the date should be an year from the date specified in sheet1.(12.12.2014 + 365 days = 12.12.2015)

If the date in sheet2 is today's date then that should be considered for ordering.
 
Sub test_dates()
y = 6
Worksheets("Sheet2").Cells(y, 16) = DateAdd("yyyy", 1, Worksheets("Sheet1").Cells(y, 16))
If Worksheets("Sheet2").Cells(y, 16) = Date Then ans = MsgBox("Do order!", vbokay, "It's today!")
End Sub
 
The above code shows the "Type mismatch" error. The date in sheet1 is in the format 12/07/2015 and the rows are dynamic, but the number of rows in sheet1 and the number of rows in sheet2 will be the same.

The date column in sheet1 is column P and in sheet2 the results should be in column Q.
 
Original msg: 'I have sheet1 and sheet2 with the same rows and columns.
In column P of sheet 1 I have a date say 12.12.2014...'
>>> ... and now You want the new day to column Q and different date formats too. You can change codes 1st and 3rd '16' to '17'. Then the result goes to 'Q-column'.
'y = 6' > After You can name ex how many rows do You have, this part has to modify ex ' for y = y1 to y2 ... code ... next y'. y1 & y2 have to solve too.
and so on ...
 
Back
Top