ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Sorting data in a master sheet (https://www.excelbanter.com/excel-worksheet-functions/29051-sorting-data-master-sheet.html)

Graham Mason

Sorting data in a master sheet
 
I have a Workbook with a number of worksheets linked to a master sheet at
the front. If any data changes in any of the worksheets, I would like to
sort automatically on the master sheet, i.e. if a date changes I would like
to sort the dates in their new order. Can this be done?
Using Excel 2003



JMB

you could right click the master sheet tab, select view code, and paste the
following into the code table.

Private Sub Worksheet_Calculate()
Sheet1.Columns("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

The range to be sorted (Sheet1.Columns("A:A")) will need to be changed
depending on the dimensions of your table (Sheet1.Range("A1:H50") - for
example). Also, you'll need to change the Key range. If your table
dimensions are dynamic, you'll likely not want to hardcode the range to be
sorted.


"Graham Mason" wrote:

I have a Workbook with a number of worksheets linked to a master sheet at
the front. If any data changes in any of the worksheets, I would like to
sort automatically on the master sheet, i.e. if a date changes I would like
to sort the dates in their new order. Can this be done?
Using Excel 2003





All times are GMT +1. The time now is 06:52 AM.

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