Hi all,
My 2003 workbook has two sheets - 'Data' and 'Front'
The user enters data in five columns - A-E in the 'data' sheet. The entered data is a dynamic named range called 'members' which grows/shrinks according as data is entered/deleted. A cell in the 'Front' sheet is validated to show the 'members' list.
I've provided a button in the data sheet to sort the data using the following code recorded with the macro recorder which works fine.
In order to provide for a situation where the user forgets to sort the data manually by using the button, I want the data to sort automatically when the 'Front' sheet is activated.
How can this be done please?
My 2003 workbook has two sheets - 'Data' and 'Front'
The user enters data in five columns - A-E in the 'data' sheet. The entered data is a dynamic named range called 'members' which grows/shrinks according as data is entered/deleted. A cell in the 'Front' sheet is validated to show the 'members' list.
I've provided a button in the data sheet to sort the data using the following code recorded with the macro recorder which works fine.
Code:
Private Sub CommandButton1_Click()
Range("A5:E5").Select
Range(Selection, Selection.End(xlDown)).Select
Sheet2.Unprotect "password"
Selection.Sort Key1:=Range("E5"), Order1:=xlAscending, Key2:=Range("D5") _
, Order2:=xlAscending, Key3:=Range("B5"), Order3:=xlDescending, Header _
:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom _
, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
Sheet2.Protect "password"
End Sub
In order to provide for a situation where the user forgets to sort the data manually by using the button, I want the data to sort automatically when the 'Front' sheet is activated.
How can this be done please?