Excel 07 sorting locked cells

  Picklefactory 09:54 26 Mar 08
Locked

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?
Thanks

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

  VoG II 10:04 26 Mar 08

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 08

Thanks VoG™
That was easy :-)

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

Huawei P10 review

1995-2015: How technology has changed the world in 20 years

An overview: What leading creative agencies are doing to improve diversity

New iPad, iPhone SE & Red iPhone 7 on sale now