Excel 07 sorting locked cells

  Picklefactory 09:54 26 Mar 2008

Morning folks
I have XL 07 workbook with a range of cells that I am sorting on workbook open (As shown below)
I want to protect the sheet so users can only select designated cells, problem is when I protect sheet it doesn't allow the sort function to run, as it also isn't allowed to select the protected cells.
Any ideas how I can get round this?

Private Sub Workbook_Open()
Range("A2:D95").Sort key1:=Range("B2"), order1:=xlAscending, _
End Sub

  VoG II 10:04 26 Mar 2008

This should work. Not that I've also qualified the sheet that this should operate on - you may need to change Sheet1 to the name of the sheet to be sorted.

Private Sub Workbook_Open()
With Sheets("Sheet1")
.Unprotect password:="xyz"
.Range("A2:D95").Sort key1:=.Range("B2"), order1:=xlAscending, Header:=xlNo
.Protect password:="xyz"
End With
End Sub

  Picklefactory 10:08 26 Mar 2008

Thanks VoG™
That was easy :-)

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Fujitsu Lifebook P727 laptop review

Converse's new logo: the trainer brand looks to its heritage for a fresh identity

Mac power user tips and hidden tricks

Comment lancer Windows 10 en mode sans échec ?