M
Midnight
Hi,
I've been searching for a solution to my problem. I have created a big
spreadsheet and would like to hide the formulas used. The only way I
can think to do this is by hiding the cell contents in the cell
properties and then protecting the worksheet.
The problem with this is that multiple sheets (that need the formulas
hidden) make use of autofilters.
I'm using Excel97 and am aware the only way around the problem is with
VB (which I'm in my infancy in learning).
I found the code below but am having problems with it. There was
initially a couple of lines which appeared to say 'If autofilter is
off, then activate'. I took this out because I only want the
autofilters that have already been set-up.
The code I have (which I pasted into 'This Workbook' object )
---------------------
Private Sub Workbook_Open()
With Worksheets("Timesheets")
EnableAutoFilter = True
Protect Password:="123", _
Contents:=True, UserInterfaceOnly:=True
End With
End Sub
Timesheets is the name of the first workbook
123 is the password (for now).
Firstly, I'd like to know why the code is still not allowing use of
the autofilter when the sheet is protected and how I can fix it.
Secondly, at the moment the code attempts to activate the autofilter
on the Timesheets worksheet only. How do I go about adding the four
additional sheets that also have autofilters. Do I set-up a new piece
of code for each, or could they all be included in one section of
code?
Thanks.
I've been searching for a solution to my problem. I have created a big
spreadsheet and would like to hide the formulas used. The only way I
can think to do this is by hiding the cell contents in the cell
properties and then protecting the worksheet.
The problem with this is that multiple sheets (that need the formulas
hidden) make use of autofilters.
I'm using Excel97 and am aware the only way around the problem is with
VB (which I'm in my infancy in learning).
I found the code below but am having problems with it. There was
initially a couple of lines which appeared to say 'If autofilter is
off, then activate'. I took this out because I only want the
autofilters that have already been set-up.
The code I have (which I pasted into 'This Workbook' object )
---------------------
Private Sub Workbook_Open()
With Worksheets("Timesheets")
EnableAutoFilter = True
Protect Password:="123", _
Contents:=True, UserInterfaceOnly:=True
End With
End Sub
Timesheets is the name of the first workbook
123 is the password (for now).
Firstly, I'd like to know why the code is still not allowing use of
the autofilter when the sheet is protected and how I can fix it.
Secondly, at the moment the code attempts to activate the autofilter
on the Timesheets worksheet only. How do I go about adding the four
additional sheets that also have autofilters. Do I set-up a new piece
of code for each, or could they all be included in one section of
code?
Thanks.