Sheet Sorting Event

R

Risky Dave

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
 
J

Joel

LastRow = Range("A" & rows.count).end(xlup).row
rows("1:" & LastRow).sort _
header:=xlyes, _
key1:=Range("B1"), _
order1:=xlascending
 
R

Risky Dave

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
 
J

Joel

Sort on column B instead of column A. Dates are a number in excel and wil
sort like any other number.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top