Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CB CB is offline
external usenet poster
 
Posts: 97
Default Over-ride protection for one user - doable???

Hi all,

I have an inventory spreadsheet for which Im responsible for entering data
but Im placing a COPY on the network for two managers to view as they need
to keep an eye on quantities.

The COPY on the network is protected (the worksheets and the workbook) and
only allows them to autofilter data (per my post Autofilter, protected
worksheet, Debra Dalgleishs code of today).

Since Im updating the workbook every week or two, I dont want to have to
update my version, make a copy, add in the code for protection and
autofiltering, then place that copy on the network.

I would like it if somehow I could enter the data into the protected
worksheet without having to unprotect each worksheet first. Ideally, I would
like it if somehow the software would recognize it is me and unprotect
everything then reinforce protection when I am done updating.

Is this possible?

I searched the Excel forum and found a post on 10/4/06 in response by JE
McGimsey <http://tinyurl.com/46jtvo to a post named Worksheet protection
in which he gives the following code.

Public Sub UnProtectAll()

Const sPWORD As String = "myPW"
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Unprotect sPWORD
Next ws
End Sub

The code worked for the original poster.

When I compile the code (which I placed in ThisWorkbook), I dont get an
error but it does not seem that this code works for me in that nothing
happens when I close the file then reopen. Im not permitted to modify
anything unless I unprotect the worksheet. When Im viewing the code and Run
Sub/User Form I get Run-time error 1004 Application-defined or
object-defined error.

What am I missing?

Thanks for any and all help!

Chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default Over-ride protection for one user - doable???

Hi Chris,

How are you calling the sub?

I think it needs to be in something like:

Private Sub Workbook_Open()

dan

  #3   Report Post  
Posted to microsoft.public.excel.programming
CB CB is offline
external usenet poster
 
Posts: 97
Default Over-ride protection for one user - doable???

Hi Dan,

I'm using the code exactly as I found it (other than a different password),
i.e.,

Public Sub UnProtectAll()

In a way it seems counter-intuitive to me to put it in Privat Sub
Workbook_Open() as that code is checking if the sheet has autofilter on and
if not enabling autofilter then protecting the sheet.

Clearly, I don't understand how the code to unprotectall works. I'd
appreciate any clarity you could provide.

Chris

"dan dungan" wrote:

Hi Chris,

How are you calling the sub?

I think it needs to be in something like:

Private Sub Workbook_Open()

dan


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default Over-ride protection for one user - doable???

Hi Chris,

I'm not quite clear.

In a way it seems counter-intuitive to me to put it in
Privat Sub Workbook_Open() as that code is checking
if the sheet has autofilter on and if not
enabling autofilter then protecting the sheet.


Which sheet are you trying to unprotect?

In your initial post you wrote:

I would like it if somehow I could enter the data into the
protected worksheet without having to unprotect each worksheet first.


How many worksheets do you need to unprotect?

Ideally, I would like it if somehow the software would recognize
it is me and unprotect everything then reinforce protection
when I am done updating.


How are the worksheets being protected, manually or by code?
What version of Excel are you using?
What type of Excel file are you using? xls? xlt?

Since Im updating the workbook every week or two,
I dont want to have to update my version, make a copy,
add in the code for protection and autofiltering,
then place that copy on the network.


What stops you from keeping your copy on the network?
I don't understand why you need to copy "your" version.

Dan
  #5   Report Post  
Posted to microsoft.public.excel.programming
CB CB is offline
external usenet poster
 
Posts: 97
Default Over-ride protection for one user - doable???

Hi Dan,

I apologize for taking so long to reply - not sure where the time went...

"dan dungan" wrote:

Hi Chris,

I'm not quite clear.

In a way it seems counter-intuitive to me to put it in
Privat Sub Workbook_Open() as that code is checking
if the sheet has autofilter on and if not
enabling autofilter then protecting the sheet.


Which sheet are you trying to unprotect?


The four indicated in the code below.


In your initial post you wrote:

I would like it if somehow I could enter the data into the
protected worksheet without having to unprotect each worksheet first.


How many worksheets do you need to unprotect?


I have four worksheets that I need to be able to unprotect (which remained
protected for anyone else).


Ideally, I would like it if somehow the software would recognize
it is me and unprotect everything then reinforce protection
when I am done updating.


How are the worksheets being protected, manually or by code?
What version of Excel are you using?
What type of Excel file are you using? xls? xlt?


The worksheets are being protected by code. I am using Excel 2003 and the
files are not templates (i.e., they are .xls not .xlt). I posted my code in
another message in this newgroup but I'm copying it below for your reference.

...........
Sub Workbook_Open()

'check for filter, turn on if none exists

With Worksheets("Depot_Inventory_Serialized")
If Not .AutoFilterMode Then
.Range("B2").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="myPW", _
Contents:=True, UserInterfaceOnly:=True
End With

With Worksheets("Warehouse_Inventory_Serialized")
If Not .AutoFilterMode Then
.Range("B2").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="myPW", _
Contents:=True, UserInterfaceOnly:=True
End With

With Worksheets("Depot_Inventory_non-Serial")
If Not .AutoFilterMode Then
.Range("B5").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="myPW", _
Contents:=True, UserInterfaceOnly:=True
End With

With Worksheets("Warehouse_Inventory_non-Serial")
If Not .AutoFilterMode Then
.Range("B5").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="myPW", _
Contents:=True, UserInterfaceOnly:=True

End With

End Sub
.......................


Since Im updating the workbook every week or two,
I dont want to have to update my version, make a copy,
add in the code for protection and autofiltering,
then place that copy on the network.


What stops you from keeping your copy on the network?
I don't understand why you need to copy "your" version.


There are two supervisors that need to open the workbook, look at the data
and use autofilters. I do not want them to accidentally change/delete data so
I protected everything, which is sufficient for their use.

The thing though is that the workbook/worksheets are still protected when I
open the file. When I need to add data, I have to unprotect each worksheet
first. I can do that but I was looking assistance with code that would allow
me to bypass that step.

I had found code within the Excel newsgroups that worked for the user who
originally posted the message but it does not appear to work for me since I
still have to go through the process of unprotecting the worksheets.

Additionally, when Im viewing the code and Run Sub/User Form I get
Run-time error 1004 Application-defined or object-defined error.

Hence, my original post.

Chris


Dan

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting ride of #n/a result from vlookup Todd F. Excel Worksheet Functions 5 May 30th 06 10:40 AM
Need to add same value to every cell...Is that doable? Brita Excel Discussion (Misc queries) 4 November 27th 04 07:33 PM
How doable Using Excel? Michael[_27_] Excel Programming 2 October 12th 04 07:32 PM
Is this doable using excel? Michael[_27_] Excel Programming 2 May 27th 04 12:46 PM
Is this doable using Excel? Michael[_27_] Excel Programming 5 May 26th 04 05:07 PM


All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"