Auto sorting

Jon Lap

New Member
Joined
Feb 16, 2007
Messages
31
Is there a way to have an excel worksheet automatically sort the data everytime new data is entered. I have daily purchase logs that 9 users fill in throughout the day as they make purchases. I would like to have it sorted by pur. amt automatically.
Thanks for your help
Jon
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
look at the worksheet_change event, you may have to disable events within the procedure and enable at the end of the procedure to keep it from continuously looping
 
Upvote 0
Is there a way to have an excel worksheet automatically sort the data everytime new data is entered. I have daily purchase logs that 9 users fill in throughout the day as they make purchases. I would like to have it sorted by pur. amt automatically.
Thanks for your help
Jon
Further to what has already been said, see if this helps:

http://www.mrexcel.com/forum/showthread.php?t=326884
 
Upvote 0
Hi Stu,
I am getting a run time error after I type in any cell after copying and pasting the code you provided.

The columns I am working with are B and E:
Col B is for client name
Col C is for description
Col D is for pur. amt
Col E for buyer initials

The data I am trying to sort begins on Row 9. The first 8 rows are fancy titles and such.

Perhaps you have an email address I can send the sheet to?
Thanks for your response.
Jon
 
Upvote 0
can you copy and paste your code you have thus far for your worksheet event
 
Upvote 0
the code that you copied from link that peter provided
 
Upvote 0
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns("P")) Then
With Intersect(ActiveSheet.UsedRange, Columns("B:P"))
.Sort Key1:=Range("P2"), Order1:=xlDescending, Header:=xlYes
End With
End If
End Sub

thanks
 
Upvote 0
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns("E")) Then
With Intersect(ActiveSheet.UsedRange, Columns("B:E"))
.Sort Key1:=Range("D9"), Order1:=xlDescending, Header:=xlYes
End With
End If
End Sub

I am just guessing at the above to adjust for your data
 
Upvote 0
Hi Jim
That change in code does not seem to help. Still getting a run time error. And the sort is not happening automatically.
Wondering if I am taking the correct steps?
I right click the tab, then view code, the paste your code in the box that appears, then close that page.
Thanks
Jon
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,052
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top