![]() |
Sheet Sorting Event
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 |
Sheet Sorting Event
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 |
Sheet Sorting Event
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 |
Sheet Sorting Event
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 |
All times are GMT +1. The time now is 09:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com