All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: excel help
PostPosted: Thu Jan 12, 2012 7:15 am 
Regular
Regular
User avatar

AKA: Cornelius Wondergarten
Hello,

I'm trying to make a spreadsheet that when you enter data into a cell it can only be deleted with a password, so using some form of protection that activates once the cell is occupied. Its not just for a few cells, but the entire sheet.

Anyone have any ideas please?


Top
 Profile  
Reply with quote  
 Post subject: Re: excel help
PostPosted: Thu Jan 12, 2012 8:39 am 
Veteran
Veteran
User avatar

LIVE: Errkal
Steam: Errkal
right click the sheet title at the bottom and select Protect you can then choose the protection level and set a password


Top
 Profile  
Reply with quote  
 Post subject: Re: excel help
PostPosted: Thu Jan 12, 2012 10:26 am 
HAS NO GAEMS
HAS NO GAEMS
User avatar

AKA: Bigbruva
LIVE: Exception OE
PSN: FatalExceptionOE
Wii #: 1337
Steam: ExceptionOE
Errkal wrote:
right click the sheet title at the bottom and select Protect you can then choose the protection level and set a password


Yeah this.

_________________
The above post, unless specifically stated to the contrary, should not be taken seriously. If the above post has offended you in any way, please fill in this form and return it to your nearest moderator.

Image


Top
 Profile  
Reply with quote  
 Post subject: Re: excel help
PostPosted: Thu Jan 12, 2012 12:32 pm 
Regular
Regular
User avatar

AKA: Cornelius Wondergarten
Thanks for the answers guys, but I should have been clearer. When user A inputs something into a cell the cell will lock, meaning user A can't change that cell, but can enter data into all other empty cells. The only way to unlock it is for user B to input a password to the unlock sheet option. This means that users can input data, but not delete it.

I found this on google:

Quote:
Right click on the tab of sheet1 and select 'view code' - then copy and paste the code in the right hand pane. Then make sure D5 and a couple of other cells are unlocked, protect your sheet without a password and try it out. You can include a password if you want - it would just be a parameter after the Unprotect or Protect commands.

Code:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address <> "$D$5" Then Exit Sub

 

Sheets("Sheet1").Unprotect

If Target.Value <> "" Then

    Target.Locked = True

End If

Sheets("Sheet1").Protect

End Sub


This works fine, but I don't know how to add the password in the code. At the moment If I lock the sheet with a password, then fill a cell it asks for a password. But the user who is entering the information wont know the password.

Anyone know how I would format that?


Top
 Profile  
Reply with quote  
 Post subject: Re: excel help
PostPosted: Thu Jan 12, 2012 6:22 pm 
Veteran
Veteran
User avatar
Quote:
users can input data, but not delete it

No idea if you can do that. Have you considered using a form for the data input?

_________________
This is the death of intelligence


Top
 Profile  
Reply with quote  
 Post subject: Re: excel help
PostPosted: Sat Jan 14, 2012 8:34 pm 
Regular
Regular
User avatar

AKA: Cornelius Wondergarten
rinks wrote:
Quote:
users can input data, but not delete it

No idea if you can do that. Have you considered using a form for the data input?


The method I mentioned before actually works. Almost.

Basically, all cells are formatted so they aren't locked (right click on them, formatting, un-check the box. Something like that). Then you lock the whole sheet (but the cells aren't locked yet, see), and what the macro I quoted before does is when ever a cell isn't empty it will check this box automatically for you, meaning to have to unlock the whole sheet to edit data. (It's a macro that's always on, not one you activate as and when you need it)

But this is no good without a password to stop people unlocking the sheet and editing the data. But if I just add a password to the sheet it needs it halfway through the macro, so only the person who knows the password can enter data, which is against the point. So I need to enter the password in the code. Somewhere. I'm not sure where.

What I might do I record a macro of me running the macro and entering the password and finding what code this makes, but I can't do this until tomorrow.

God damn, I hate only knowing enough to know I don't know what I'm doing.


Top
 Profile  
Reply with quote  
 Post subject: Re: excel help
PostPosted: Sun Jan 15, 2012 11:47 pm 
Regular
Regular
User avatar

AKA: Cornelius Wondergarten
Turns out all I need to do was add ("password") after .unprotect or .protect

Damn, at least it works now.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC



Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group