View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RS RS is offline
external usenet poster
 
Posts: 113
Default Any macro experts out there?

Dear Arvi,

Does your code apply the same password for all protected sheets in a
workbook? In my case, I have differnet passwords for different sheets in the
workbook.

"Arvi Laanemets" wrote:

Hi

I myself use somewhat simpler code

Private Sub Workbook_Open()
Sheets("SheetName").Unprotect Password:="MyPassword"
Sheets("SheetName").Protect Password:="MyPassword",
UserInterfaceOnly:=True
Sheets("SheetName").EnableAutoFilter = True
' Repeat for all protected sheets
End Sub

Sorry, but it looks like Excel2000 doesn't allow to sort protected sheets -
there exist no appropriate property for Sheet object you can change (like
you can change EnableAutoFilter property for Sheet object).


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )



"RS" wrote in message
...
Hi everyone. This is my third attempt at getting this question answered,
so
I'm sorry if this question looks familiar to some of you but no one has
answered the question yet. Here it is:

I know that Excel 2000 disables the autofilter function when
the worksheet is protected and hence copied and modified a macro into
"ThisWorkbook" that would fix this. However, I also just read that the
sorting function is also disabled in Excel 2000. So my question is...how
would I modify my existing macro (or add a new macro) to also allow me to
sort? Here is the macro that I have in "ThisWorkbook":

Private Sub Workbook_Open()
'check for filter, turn on if none exists
With Worksheets("Worksheet")
If Not .AutoFilterMode Then
.Range("A1").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="temp", _
Contents:=True, UserInterfaceOnly:=True
End With
End Sub