RobbieC
Active Member
- Joined
- Dec 14, 2016
- Messages
- 376
- Office Version
- 2010
- Platform
- Windows
Hi there, I have a worksheet with 5 dates in cells (A1, A101, A201, A301 & A401) - they are all formatted dd/mm/yyyy
I need to copy the date from these cells to other cells on another sheet but change the formats to yyyy-mm-dd - I thought I could use:
but that didn't work - it just keeps the same format...
Secondly, I need to work out the MAX or latest date in these 5 cells - I thought I could use:
but it didn't like that either... obviously, doing stuff with dates isn't my strong point
If you can point me in the right direction, I'd be really grateful.
Thanks
I need to copy the date from these cells to other cells on another sheet but change the formats to yyyy-mm-dd - I thought I could use:
Code:
Date1 = Sheets("Sheet1").Range("A1").Value
Date1 = Format(Date1, "yyyy-mm-dd")
Sheets("Sheet2").Range("A1").Value = Date1
but that didn't work - it just keeps the same format...
Secondly, I need to work out the MAX or latest date in these 5 cells - I thought I could use:
Code:
EndDate1 = Sheets("Sheet1").Range("A1").Value
EndDate2 = Sheets("Sheet1").Range("A101").Value
EndDate3 = Sheets("Sheet1").Range("A201").Value
EndDate4 = Sheets("Sheet1").Range("A301").Value
EndDate5 = Sheets("Sheet1").Range("A401").Value
EndDateMax = WorksheetFunction.Max(EndDate1, EndDate2, EndDate3, EndDate4, EndDate5)
but it didn't like that either... obviously, doing stuff with dates isn't my strong point
If you can point me in the right direction, I'd be really grateful.
Thanks