ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I make a section sort automatically? (https://www.excelbanter.com/excel-discussion-misc-queries/89538-how-do-i-make-section-sort-automatically.html)

Wicus

How do I make a section sort automatically?
 
I want a section to sort itself automatically when the information is updated

Gary''s Student

How do I make a section sort automatically?
 
If the section is A1 thru C10 (no headers), then enter the following in
worksheet code:

Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Range("A1:C10"), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range("A1:C10").Sort Key1:=Range("A1")
Application.EnableEvents = True
End Sub

This will cause automatic re-sort (using column A as the key) after the data
has been updated.
--
Gary''s Student


"Wicus" wrote:

I want a section to sort itself automatically when the information is updated



All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com