Store input from userform in a password protected sheet

S

sam

Hi All, I have designed a userform which accepts inputs and the inputs are
stored on Sheet2 of the same work book. Is there any way I can password
protect Sheet2 and still receive userinputs from userform in Sheet2?

Thanks in Advance
 
J

john

With Worksheets("Sheet2")

.Unprotect Password:=MyPassword

' do your stuff

.Protect Password:=MyPassword

End With
 
S

sam

Thanks for the help, It does work now. But, I didnt kow we can still delete a
sheet even if it is protected. Is there a way where users cannot delete a
sheet?

Thanks in Advance
 
J

john

Sam,
try this

Dim Mypassword As String

Mypassword = "ABCD1234"

With ThisWorkbook

.Unprotect Password:=Mypassword

With Worksheets("Sheet2")

.Unprotect Password:=Mypassword

' do your stuff

.Protect Password:=Mypassword

End With

.Protect Password:=Mypassword

End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top