I had a similar problem before. When you protect the sheet you need to ADD a couple of check marks under the section
"Allow all users of this worksheet to:"
Check off "Sort" and "Use Auto Filter" and this may resolve your problem.
As for the VBA Code here is what I get when I record the macro as described above. Hopefully you can implement it:
Good Luck. Hope this helps.Code:Sub ProtectWithAutoFilterAndSortCapabilities() ' ' ProtectWithAutoFilterAndSortCapabilities Macro ' Macro recorded 27/05/2009 ' ' ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowSorting:=True, AllowFiltering:=True End Sub