Rowland Hamilton
Active Member
- Joined
- Nov 13, 2009
- Messages
- 250
Folks: How can I sort a date column by year without creating a parallel, offset column that holds the formula like Year(rcell.value)? like:
My guess is impossible, but...
Thank you - Rowland
Code:
'Sort
'change sort keys to year(column 3.value), column 1, column 3
sheet1.UsedRange.Offset(6, 0).Sort _
key1:=Sheet1.UsedRange.>>Year of these values<<.Columns(1).Offset(7, 0).Resize(1, 1), _
order1:=xlAscending, _
key2:=Sheet1.UsedRange.Columns(1).Offset(7, 0).Resize(1, 1), _
order1:=xlAscending, _
key3:=Sheet1.UsedRange.Columns(3).Offset(7, 0).Resize(1, 1), _
order1:=xlAscending, _
Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Thank you - Rowland