ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Using macro to un/protect sheet (https://www.excelbanter.com/excel-worksheet-functions/72237-using-macro-un-protect-sheet.html)

Bonbon

Using macro to un/protect sheet
 
hi hi, thx agen for the previous helps =D
i searched this up to see if i could find nething b4 disturbing you nice ppl
lol, but i still dont understand.
i want to make a button, which will allow the user to View the books n not
rewrite. And a button which allows the user to actually add/edit the data,
however this user would need to enter a password. i want both buttons to open
the same workbook, but each with a different authority. I dont know how to
create like a message or box where the user has to enter a password to gain
access in adding new data .
i've been thinkin long and hard but dont know where to start, can anyone
help me out? lol

thanks in advance =)

Paul B

Using macro to un/protect sheet
 
Bonbon, how about something like this on the sheet so the user would have to
enter a password to edit

Sub PassWord_To_Edit()
'must lock VBA project so you can't see the password in it
Dim MyStr1 As String, MyStr2 As String
With ActiveSheet
MyStr2 = ("123") 'This is the password and it is CASE sensitive
MyStr1 = InputBox("Password Is Required To Add/Edit Data")
If MyStr1 = MyStr2 Then

'put your code here to add data

Else
MsgBox ("Access Denied")
End If
End With
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Bonbon" wrote in message
...
hi hi, thx agen for the previous helps =D
i searched this up to see if i could find nething b4 disturbing you nice

ppl
lol, but i still dont understand.
i want to make a button, which will allow the user to View the books n not
rewrite. And a button which allows the user to actually add/edit the data,
however this user would need to enter a password. i want both buttons to

open
the same workbook, but each with a different authority. I dont know how to
create like a message or box where the user has to enter a password to

gain
access in adding new data .
i've been thinkin long and hard but dont know where to start, can anyone
help me out? lol

thanks in advance =)




Bonbon

Using macro to un/protect sheet
 

Thank you Paul B, that worked great!
you said, lock VBA project, how?

thanks again


--
Bonbon
------------------------------------------------------------------------
Bonbon's Profile: http://www.excelforum.com/member.php...o&userid=31866
View this thread: http://www.excelforum.com/showthread...hreadid=513415



All times are GMT +1. The time now is 05:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com