Submit data entry into the protected sheet without being able to edit by the user,is it possible?

megna

New Member
Joined
Sep 26, 2012
Messages
2
Hi everyone...

I have created a simple userform that is linked to a button on sheet1. When the data in the userform is submitted, I set it up so it goes into a database under sheet2. The problem is, I don't want anyone modifying the entries in the database. Usually I would protect the sheet with a password, but when I do that, there is an error when the userform is submitted. The only thing I can think of is to hide sheet2, which doesn't seem like a great solution.

Is there any way to protect my database from being modified yet still allow the userform to be linked to it?

Thanks, and I hope this makes sense
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
You can modify the following script so that when you call your userform you unprotect your sheet and then when the code has finished running you then protect the sheet.

Code:
Sub ProtectSheet()
Dim Password    'This line of code is optional
Password = "1234"
ActiveSheet.Protect Password, True, True, True
'Add in the following line if you want the user
'to be able to select the cell but not change anything
'ActiveSheet.EnableSelection = xlNoRestrictions
End Sub


Sub UnProtectSheet()
Password = "1234"
ActiveSheet.Unprotect Password
End Sub
 
Upvote 0
Thank you very much dear.My coding was working perfectly but all of a sudden I can't even lock the sheet as usual. Any idea why?Thanks again
 
Upvote 0
If it isn't working then either it is already locked or somewhere along the line you have entered wrong code.

If you want you can send me a dummy copy of your workbook with any sensitive data removed and I can have a look at it.

If you want me to look at the code then you can send me a private message through this site and I will then give you my email address.
 
Upvote 0

Forum statistics

Threads
1,215,334
Messages
6,124,319
Members
449,153
Latest member
JazzSingerNL

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top