Activate Event Example

This example sorts the range A1:A10 when the worksheet is activated.

Private Sub Worksheet_Activate()
    Range("a1:a10").Sort Key1:=Range("a1"), Order:=xlAscending
End Sub