Sorting data in a master sheet

  • Thread starter Thread starter Graham Mason
  • Start date Start date
G

Graham Mason

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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top