Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I sort several columns with numbers tied to company names? | Excel Discussion (Misc queries) | |||
writing macros in excel sheet | Excel Worksheet Functions | |||
Need help writing basic macros in EXCEL.. | Excel Discussion (Misc queries) | |||
Using Macro to Sort Names, Numbers & addresses | Excel Worksheet Functions | |||
how to sort names and social security numbers a to z | Excel Worksheet Functions |