sdcowley
07-14-2010, 09:12 AM
Hi again,
My workbook is shared and some sheets are protected.
One of the protected sheets is "Task Data" that contains loads of data about task.s
My "Report" sheet allows users to report against that data - this capability works perfectly fine when Task Data is not protected. Like so;
ElseIf ReportsLst.Value = "Report: by CSR Group" Then
Worksheets("Menu").Activate
Worksheets("Task Data").Visible = True
Worksheets("Task Data").Activate
Selection.AutoFilter Field:=2, Criteria1:=AFCriteria
However, when Task Data is protected (which it needs to be) and when the workbook is shared (which it needs to be), the autofilter doesn't work with the above code. It fails on the selection.autofilter ...
I can, however, go in to task data manually and change the autofilter because when I protected the sheet, I ticked the "Use AutoFilter" box.
I'm guessing it's failing because of the "selection" part of the code and selecting cells isn't allowed (as the data shouldn't be editable from here.)
I've tried the following code, which gets rid of the "selection" part but this doesn't work either. I use A3 because that the first cell in the row that has the AutoFilter. AutoFilter range is A3:AH3 unless the range is meant to refer to the data range which is A4:AH65000 (i've also tried using A4 as the range)
ElseIf ReportsLst.Value = "Report: by CSR Group" Then
Worksheets("Menu").Activate
Worksheets("Task Data").Visible = True
Worksheets("Task Data").Activate
Worksheets.Range("A3").AutoFilter Field:=2, Criteria1:=AFCriteria
This code fails on the ".range" aspect with the error;
"Method or Data Member Not Found"
Is there anything I can do to resolve this or is it just a niggling Excel problem that I can't change?
My workbook is shared and some sheets are protected.
One of the protected sheets is "Task Data" that contains loads of data about task.s
My "Report" sheet allows users to report against that data - this capability works perfectly fine when Task Data is not protected. Like so;
ElseIf ReportsLst.Value = "Report: by CSR Group" Then
Worksheets("Menu").Activate
Worksheets("Task Data").Visible = True
Worksheets("Task Data").Activate
Selection.AutoFilter Field:=2, Criteria1:=AFCriteria
However, when Task Data is protected (which it needs to be) and when the workbook is shared (which it needs to be), the autofilter doesn't work with the above code. It fails on the selection.autofilter ...
I can, however, go in to task data manually and change the autofilter because when I protected the sheet, I ticked the "Use AutoFilter" box.
I'm guessing it's failing because of the "selection" part of the code and selecting cells isn't allowed (as the data shouldn't be editable from here.)
I've tried the following code, which gets rid of the "selection" part but this doesn't work either. I use A3 because that the first cell in the row that has the AutoFilter. AutoFilter range is A3:AH3 unless the range is meant to refer to the data range which is A4:AH65000 (i've also tried using A4 as the range)
ElseIf ReportsLst.Value = "Report: by CSR Group" Then
Worksheets("Menu").Activate
Worksheets("Task Data").Visible = True
Worksheets("Task Data").Activate
Worksheets.Range("A3").AutoFilter Field:=2, Criteria1:=AFCriteria
This code fails on the ".range" aspect with the error;
"Method or Data Member Not Found"
Is there anything I can do to resolve this or is it just a niggling Excel problem that I can't change?