H
Hugh
Using Excel 2002 on XP, I have created a workbook which I use to
collect financial submissions in a database format. The spreadsheet
uses AutoFilters to suppress lines in the database such that only the
lines relevant to a particular respondent are displayed.
I can protect the workbook sheets, protect and share the workbook and
then operate the AutoFilters manually, but I cannot do the same and
then reliably operate the AutoFilters by macro.
It will work after doing the above whilst I am still in the workbook.
But if I close and reopen it, I get ‘Run-time error 1004 You cannot
use this command on a protected sheet etc…"
The code I use to protect the sheet is:
Sub Protect()
Sheets("Sheet1").Protect Contents:=True, UserInterfaceOnly:=True _
, AllowFiltering:=True
End Sub
The code I am trying to use to operate the AutoFilters is:
Sub Select()
Selection.AutoFilter Field:=2, Criteria1:="Selection"
End Sub
Can anybody suggest alternative code to operate the filters?
Thanks,
Hugh
collect financial submissions in a database format. The spreadsheet
uses AutoFilters to suppress lines in the database such that only the
lines relevant to a particular respondent are displayed.
I can protect the workbook sheets, protect and share the workbook and
then operate the AutoFilters manually, but I cannot do the same and
then reliably operate the AutoFilters by macro.
It will work after doing the above whilst I am still in the workbook.
But if I close and reopen it, I get ‘Run-time error 1004 You cannot
use this command on a protected sheet etc…"
The code I use to protect the sheet is:
Sub Protect()
Sheets("Sheet1").Protect Contents:=True, UserInterfaceOnly:=True _
, AllowFiltering:=True
End Sub
The code I am trying to use to operate the AutoFilters is:
Sub Select()
Selection.AutoFilter Field:=2, Criteria1:="Selection"
End Sub
Can anybody suggest alternative code to operate the filters?
Thanks,
Hugh