Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying two things that aren't working and it's driving me nuts. I need
my workbook protected when the workbook is opened. For some reason, workbook protection is a toggle. I'll open it once and it's protected. I'll open it next time and it's not protected. The other thing I can't get to work is to turn on autofilter in sheet 'ImportData' each time the workbook opens. Any ideas what I'm doing wrong? I've tried for hours. . . thanks. Here's my code: Private Sub Workbook_BeforeClose(Cancel As Boolean) ActiveSheet.AutoFilterMode = False End Sub Private Sub Workbook_Open() On Error Resume Next AddIns("Analysis ToolPak").Installed = True AddIns("Analysis ToolPak - VBA").Installed = True Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Unprotect password:="mwimport" Next ws Worksheets("ImportData").Range("A1:P5000").Locked = True Worksheets("Trends").Range("A1:BC25").Locked = True Worksheets("Chart Data").Range("A1:W72").Locked = True Dim wsh As Worksheet For Each wsh In ThisWorkbook.Worksheets wsh.Protect password:="mwimport" Next wsh 'Hide the OriginalTrends sheet Sheets("OriginalTrends").Visible = False Worksheets("ImportData").Unprotect password:="mwimport" Worksheets("ImportData").Activate Range("A1").Select ActiveSheet.AutoFilterMode = True ActiveWorkbook.Protect password:="mwimport" End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need my workbook protected when the workbook is opened.
It's protected when I open it. The other thing I can't get to work is to turn on autofilter in sheet 'ImportData' each time the workbook opens. From excel 2000 vba help AutoFilterMode Property True if the AutoFilter drop-down arrows are currently displayed on the sheet. This property is independent of the FilterMode property. Read/ write Boolean. Remarks This property returns True if the drop-down arrows are currently displayed. You can set this property to False to remove the arrows, but you cannot set it to True. Use the AutoFilter method to filter a list and display the drop-down arrows. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can protect worksheet then workbook but not Protect and Share in code | Excel Programming | |||
Protect Workbook Vs Protect Sheet | New Users to Excel | |||
Disable Tools, Protect, Protect Workbook | Excel Programming | |||
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? | Excel Programming | |||
Protect workbook? | Excel Programming |