Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Writing 2 macros to sort names and numbers in excel 97

I have created a simlpe spreadsheet that records employees names and
serial numbers, as well as hours worked Monday to Friday. The
spreadsheet has formula to total the hours worked each week for each
employee as well the total hours worked daily for all employees.At the
moment there are three employees in the spreadsheet.I need help to
write 2 macros,the first macro will sort the employees by their name
the second will sort the employees by their serial number.I have
created a macro that inserts a new row containg all the formula under
the last employee in the spread sheet, this will allow the spreadsheet
to expand with additional employees. The 2 macros to sort by name and
serial number must be able to expand and sort all employees as the
spreadsheet expands.
The spreadsheet is set out as follows. In column A at A19 is the
heading name,column B at B19 is number, C19 is Mon.Hours,D19
Tues.Hours, E19 Wed.Hours F19 Thurs.Hours,G19
Fri.Hours,H19 Weekly total.

At A20,A21.A22 are the three employees names.At B20,B21,B22, are the
serial numbers of these employees.The hours they work the week are in
the columns C,D,E,F,G and the total for the week is in column H.

The 2 macors to sort the employees by name and by number must expand
as the spread sheet expands with the addition of new employees.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Writing 2 macros to sort names and numbers in excel 97

Paul

you should record a macro whilst you sort the records manually. You should
get something similar to this:

Selection.Sort Key1:=Range("A2"), _
Order1:=xlAscending, _
Key2:=Range("B2"), _
Order2:=xlAscending, _
Key3:=Range("C2"), _
Order3:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom

Adjust to match your requirements.

Regards

Trevor


"Paul" wrote in message
om...
I have created a simlpe spreadsheet that records employees names and
serial numbers, as well as hours worked Monday to Friday. The
spreadsheet has formula to total the hours worked each week for each
employee as well the total hours worked daily for all employees.At the
moment there are three employees in the spreadsheet.I need help to
write 2 macros,the first macro will sort the employees by their name
the second will sort the employees by their serial number.I have
created a macro that inserts a new row containg all the formula under
the last employee in the spread sheet, this will allow the spreadsheet
to expand with additional employees. The 2 macros to sort by name and
serial number must be able to expand and sort all employees as the
spreadsheet expands.
The spreadsheet is set out as follows. In column A at A19 is the
heading name,column B at B19 is number, C19 is Mon.Hours,D19
Tues.Hours, E19 Wed.Hours F19 Thurs.Hours,G19
Fri.Hours,H19 Weekly total.

At A20,A21.A22 are the three employees names.At B20,B21,B22, are the
serial numbers of these employees.The hours they work the week are in
the columns C,D,E,F,G and the total for the week is in column H.

The 2 macors to sort the employees by name and by number must expand
as the spread sheet expands with the addition of new employees.



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
How do I sort several columns with numbers tied to company names? gobblegobs Excel Discussion (Misc queries) 1 January 25th 08 12:16 AM
writing macros in excel sheet Richard Buttrey Excel Worksheet Functions 7 May 10th 06 01:04 AM
Need help writing basic macros in EXCEL.. Macro Help Excel Discussion (Misc queries) 1 March 8th 05 02:28 PM
Using Macro to Sort Names, Numbers & addresses Tareq Excel Worksheet Functions 1 March 1st 05 02:08 PM
how to sort names and social security numbers a to z olajune1 Excel Worksheet Functions 2 February 25th 05 12:31 PM


All times are GMT +1. The time now is 03:52 PM.

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

About Us

"It's about Microsoft Excel"