PDA

View Full Version : Auto Sort Entries



ajames420
08-27-2007, 05:48 AM
Does anybody know if there is a way to auto sort entries on a spreadsheet after data is entered from a user form?

Example:
I have users enter Hub name, CSR, Customer, Date, Pkg Quantity.

After they enter the data I would like to sort by Hub Name and Date.

Is this possible?

Bob Phillips
08-27-2007, 05:50 AM
Fire the sort from the userform code.

ajames420
08-27-2007, 06:01 AM
Seeing as I don't program in Excel very often if at all I am not sure where or how I would fire that up. Can you explain please?

lucas
08-27-2007, 06:29 AM
Since you are inexperienced you should get familiar with the macro recorder. Just record the sort the way you want it and add it to your code. The following was done this way and it will sort by column D down 100 rows:


Sub Macro1()
Rows("1:100").Select
Selection.Sort Key1:=Range("D1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

ajames420
08-27-2007, 06:35 AM
Thank you very much.

I recorded it and it works great.

One last thing. Is there a way to delete data from a spreadsheet if let's say the date is less then today? If so How would I do that?

lucas
08-27-2007, 06:40 AM
Begin by marking this thread solved and starting a new thread.