PDA

View Full Version : [SOLVED] Auto Sort a Worksheet when selected



gersemale
07-28-2005, 01:01 AM
Hi folks,

Wondering if this is possible, where by when I select a worksheet the data is sorted by column b.

I have used the following function, however this depends on the a change being made to a worksheet. The values on this sheet are determined from lookup values and the data will never manually change on this sheet. So the only option appears to be to sort the data when ever a change occurs on the data entry sheet, or when the sheet in question is selected.


Private Sub Worksheet_Change(ByVal Target As Range)
Range("B2").Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

Thanks for your help,

Ger

Bob Phillips
07-28-2005, 01:49 AM
Just use the Worksheet_Activate event.

gersemale
07-28-2005, 02:04 AM
lol! thanks xld!