Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Sheet causes Combo Box change event to fire on original sheet AJ Master Excel Programming 0 November 10th 08 07:49 PM
Sorting and the Worksheet Change Event Gary''s Student Excel Programming 4 August 18th 08 08:19 PM
Auto sorting multiple ranges on event rlutes Excel Programming 2 June 17th 05 04:52 AM
Return to Current Sheet in On (sheet activate) event macro Paul Moles Excel Programming 1 March 27th 05 03:16 PM
Assign values to a cell in sheet A, from worksheet_change event of sheet B Arif Khan Excel Programming 1 May 4th 04 04:51 AM


All times are GMT +1. The time now is 10:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"