![]() |
check to see if all dates are for the current year
I have a col of dates. I wish to check to be sure they are all for the
current year and if any incorrect ones are found then change them to the current year oldjay |
check to see if all dates are for the current year
Assuming you just want to change the year. Tailor to fit your needs.
Sub ABC() Dim rng as Range, cell as Range set rng = Range(cells(1,"C"),cells(rows.count,"C").End(xlup) ) for each cell in rng if year(cell.Value) < year(date) then cell.Value = dateSerial(year(date),month(cell),day(cell)) end if Next End Sub -- Regards, Tom Ogilvy "Oldjay" wrote in message ... I have a col of dates. I wish to check to be sure they are all for the current year and if any incorrect ones are found then change them to the current year oldjay |
check to see if all dates are for the current year
Thanks Works Great
oldjay "Tom Ogilvy" wrote: Assuming you just want to change the year. Tailor to fit your needs. Sub ABC() Dim rng as Range, cell as Range set rng = Range(cells(1,"C"),cells(rows.count,"C").End(xlup) ) for each cell in rng if year(cell.Value) < year(date) then cell.Value = dateSerial(year(date),month(cell),day(cell)) end if Next End Sub -- Regards, Tom Ogilvy "Oldjay" wrote in message ... I have a col of dates. I wish to check to be sure they are all for the current year and if any incorrect ones are found then change them to the current year oldjay |
All times are GMT +1. The time now is 02:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com