ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort on collumn H when leaving sheet (https://www.excelbanter.com/excel-programming/377567-sort-collumn-h-when-leaving-sheet.html)

hans[_3_]

Sort on collumn H when leaving sheet
 
I would like sheet "klanten" to be sorted on collumn h when i leave this
sheet to go to an other.
Worksheet_Deactivate does not seems to do the trick becaurce i have to go
back to sheet "klanten" sort and go to the next sheet.
I end up with a loop.

Can someone help?

Greetings Hans



AndrewArmstrong

Sort on collumn H when leaving sheet
 
Try this?

Option Explicit

Private Sub Worksheet_Deactivate()

Sheets("Klanten").Columns(8).Sort Key1:=Range("H1"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub

This worked for me.
Andrew Armstrong

hans wrote:
I would like sheet "klanten" to be sorted on collumn h when i leave this
sheet to go to an other.
Worksheet_Deactivate does not seems to do the trick becaurce i have to go
back to sheet "klanten" sort and go to the next sheet.
I end up with a loop.

Can someone help?

Greetings Hans



hans[_3_]

Sort on collumn H when leaving sheet
 
Thanks Hans


"AndrewArmstrong" schreef in bericht
oups.com...
Try this?

Option Explicit

Private Sub Worksheet_Deactivate()

Sheets("Klanten").Columns(8).Sort Key1:=Range("H1"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub

This worked for me.
Andrew Armstrong

hans wrote:
I would like sheet "klanten" to be sorted on collumn h when i leave this
sheet to go to an other.
Worksheet_Deactivate does not seems to do the trick becaurce i have to go
back to sheet "klanten" sort and go to the next sheet.
I end up with a loop.

Can someone help?

Greetings Hans






All times are GMT +1. The time now is 09:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com