View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Visual basic unlock "SORT" function in an EXCEL spreadsheet

In Excel 2002 and later, it is an argument to the Protect methods.

In earlier versions, you can't enable it. However, you should be still be
able to sort with code using the UserInterfaceOnly argument.

--
Regards,
Tom Ogilvy

"Jetty" wrote in message
oups.com...
How do I add a string to enable the "SORT" function in the following
workbook?

My current string in the spreadsheet is as follows:

Private Sub Workbook_Open()

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets(Array("Key Controls", "NonKey
Controls"))
With ws
.Protect Password:="sox2005", DrawingObjects:=True, _
contents:=True, Scenarios:=True, _
userinterfaceonly:=True
.EnableAutoFilter = True
.EnableOutlining = True
End With
Next ws
End Sub