2007年11月24日 星期六

【文書編輯】Excel 自動排序

將程式碼寫在該工作頁裡面

物件選 WorkSheet , 程序選 SelectionChange

rder1:=xldescending表示降序 order1:=xlascending則表示升序。

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

[A1].Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

End Sub

貼上以上程式碼後點擊就會自動執行

沒有留言: