Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, On one sheet I have a list of names, and on another the same names (though not necessarily in the same order) and two other columns (not contiguous to the names column) that calculate the age in number of complete years and number of odd months; eg: A B C D Name date of birth full years from dob additional months from dob so it would look like (for June 2009): A B C D Janet 01/01/75 34 6 What I am after is a bit of code that can sit in the worksheet Change Event and sort the list of names only by date of birth, oldest to youngest. Any help would be appreciated. TIA Dave |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() LastRow = Range("A" & rows.count).end(xlup).row rows("1:" & LastRow).sort _ header:=xlyes, _ key1:=Range("B1"), _ order1:=xlascending "Risky Dave" wrote: Hi, On one sheet I have a list of names, and on another the same names (though not necessarily in the same order) and two other columns (not contiguous to the names column) that calculate the age in number of complete years and number of odd months; eg: A B C D Name date of birth full years from dob additional months from dob so it would look like (for June 2009): A B C D Janet 01/01/75 34 6 What I am after is a bit of code that can sit in the worksheet Change Event and sort the list of names only by date of birth, oldest to youngest. Any help would be appreciated. TIA Dave |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Joel, Thanks for the response, but I don't think that I have made myself clear. On sheet "Names" I have: A Janet John William On sheet "Data" I have: A B William 1/1/70 John 2/2/75 Janet 3/3/80 On the "Names" sheet is a toggle switch which will select between sorting the names alpahbetically, giving: A Janet John William or by date of birth (oldest to youngest), giving: A William John Janet I have got the alphabetical sort working but can't figure out how to do the sort by birthdate. TIA Dave "Joel" wrote: LastRow = Range("A" & rows.count).end(xlup).row rows("1:" & LastRow).sort _ header:=xlyes, _ key1:=Range("B1"), _ order1:=xlascending "Risky Dave" wrote: Hi, On one sheet I have a list of names, and on another the same names (though not necessarily in the same order) and two other columns (not contiguous to the names column) that calculate the age in number of complete years and number of odd months; eg: A B C D Name date of birth full years from dob additional months from dob so it would look like (for June 2009): A B C D Janet 01/01/75 34 6 What I am after is a bit of code that can sit in the worksheet Change Event and sort the list of names only by date of birth, oldest to youngest. Any help would be appreciated. TIA Dave |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Sort on column B instead of column A. Dates are a number in excel and wil sort like any other number. "Risky Dave" wrote: Joel, Thanks for the response, but I don't think that I have made myself clear. On sheet "Names" I have: A Janet John William On sheet "Data" I have: A B William 1/1/70 John 2/2/75 Janet 3/3/80 On the "Names" sheet is a toggle switch which will select between sorting the names alpahbetically, giving: A Janet John William or by date of birth (oldest to youngest), giving: A William John Janet I have got the alphabetical sort working but can't figure out how to do the sort by birthdate. TIA Dave "Joel" wrote: LastRow = Range("A" & rows.count).end(xlup).row rows("1:" & LastRow).sort _ header:=xlyes, _ key1:=Range("B1"), _ order1:=xlascending "Risky Dave" wrote: Hi, On one sheet I have a list of names, and on another the same names (though not necessarily in the same order) and two other columns (not contiguous to the names column) that calculate the age in number of complete years and number of odd months; eg: A B C D Name date of birth full years from dob additional months from dob so it would look like (for June 2009): A B C D Janet 01/01/75 34 6 What I am after is a bit of code that can sit in the worksheet Change Event and sort the list of names only by date of birth, oldest to youngest. Any help would be appreciated. TIA Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy Sheet causes Combo Box change event to fire on original sheet | Excel Programming | |||
Sorting and the Worksheet Change Event | Excel Programming | |||
Auto sorting multiple ranges on event | Excel Programming | |||
Return to Current Sheet in On (sheet activate) event macro | Excel Programming | |||
Assign values to a cell in sheet A, from worksheet_change event of sheet B | Excel Programming |