Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
convert existing range of dates to to current year, maintaining mm | New Users to Excel | |||
When typing dates do not default to current year. | Excel Worksheet Functions | |||
Converting Older Dates to Current Year | Excel Worksheet Functions | |||
Combination Graph with current year and prior year sales | Charts and Charting in Excel | |||
lock up rows w/dates diff than current year | Excel Programming |