close

I want to protect all the worksheets
however leave the pivot tables for Filtering

I have excel 2000.

Is it still possible?
Assuming the Pivot Tables are already in place, you can use the
workbook_Open event to set the EnablePivotTable property to true. You would
also need to set UserInterFaceOnly to true for the protect method.

From the help on EnablePivotTable

-----------------------------------------------

ActiveSheet.EnableOutlining = True
ActiveSheet.Protect contents:=True, userInterfaceOnly:=True

----------------------------------------------

so you would do something like

Private Sub Workbook_Open
Dim sh as Worksheet, sh1 as Worksheet
set sh1 = ActiveSheet
for each sh in Thisworkbook.Worksheets
sh.Select
sh.EnablePivotTable = True
sh.Protect Contents:=True, UserInterfaceOnly:=True
Next
sh1.Activate
End Sub

Use the workbook_Open Event

See Chip Pearson's page on Events if not familiar
www.cpearson.com/excel/events.htm

See this article for additional info (pertinent to xl2000 as well)

support.microsoft.com/kb/169106/en-us

--
Regards,
Tom Ogilvy
quot;flow23quot; gt; wrote in message
...
gt; I want to protect all the worksheets
gt; however leave the pivot tables for Filtering
gt;
gt; I have excel 2000.
gt;
gt; Is it still possible?
gt;
gt;
Thanks

Its works fine.. except when it selects the last sheet . an error occurs

quot; Run time error 1004
: Method quot;select of object_worksheet failedquot;

Any ideas why?
quot;Tom Ogilvyquot; wrote:

gt; Assuming the Pivot Tables are already in place, you can use the
gt; workbook_Open event to set the EnablePivotTable property to true. You would
gt; also need to set UserInterFaceOnly to true for the protect method.
gt;
gt; From the help on EnablePivotTable
gt;
gt; -----------------------------------------------
gt;
gt; ActiveSheet.EnableOutlining = True
gt; ActiveSheet.Protect contents:=True, userInterfaceOnly:=True
gt;
gt; ----------------------------------------------
gt;
gt; so you would do something like
gt;
gt; Private Sub Workbook_Open
gt; Dim sh as Worksheet, sh1 as Worksheet
gt; set sh1 = ActiveSheet
gt; for each sh in Thisworkbook.Worksheets
gt; sh.Select
gt; sh.EnablePivotTable = True
gt; sh.Protect Contents:=True, UserInterfaceOnly:=True
gt; Next
gt; sh1.Activate
gt; End Sub
gt;
gt; Use the workbook_Open Event
gt;
gt; See Chip Pearson's page on Events if not familiar
gt; www.cpearson.com/excel/events.htm
gt;
gt; See this article for additional info (pertinent to xl2000 as well)
gt;
gt; support.microsoft.com/kb/169106/en-us
gt;
gt; --
gt; Regards,
gt; Tom Ogilvy
gt;
gt;
gt;
gt; quot;flow23quot; gt; wrote in message
gt; ...
gt; gt; I want to protect all the worksheets
gt; gt; however leave the pivot tables for Filtering
gt; gt;
gt; gt; I have excel 2000.
gt; gt;
gt; gt; Is it still possible?
gt; gt;
gt; gt;
gt;
gt;
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()